summaryrefslogtreecommitdiff
path: root/spec/initializers/rails_asset_host_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-10 21:10:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-10 21:10:06 +0000
commitcaff5659c981d9b8ed2c086fb35deac9e189b865 (patch)
tree6129c7c93513655eff4a3e0351fb902ac2ed3127 /spec/initializers/rails_asset_host_spec.rb
parent1c17f34a4bdf51030a36985b097161a914fb7ea8 (diff)
downloadgitlab-ce-caff5659c981d9b8ed2c086fb35deac9e189b865.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers/rails_asset_host_spec.rb')
-rw-r--r--spec/initializers/rails_asset_host_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/initializers/rails_asset_host_spec.rb b/spec/initializers/rails_asset_host_spec.rb
new file mode 100644
index 00000000000..682ef9d9bbe
--- /dev/null
+++ b/spec/initializers/rails_asset_host_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Rails asset host initializer' do
+ def load_initializer
+ load Rails.root.join('config/initializers/rails_asset_host.rb')
+ end
+
+ subject { Rails.application.config.action_controller.asset_host }
+
+ it 'uses no asset host by default' do
+ load_initializer
+
+ expect(subject).to be nil
+ end
+
+ context 'with cdn_host defined in gitlab.yml' do
+ before do
+ stub_config_setting(cdn_host: 'https://gitlab.example.com')
+ end
+
+ it 'returns https://gitlab.example.com' do
+ load_initializer
+
+ expect(subject).to eq('https://gitlab.example.com')
+ end
+ end
+end