From 56bcb3e8c87bf25cb33ed02832c146e966cc4d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Sat, 3 Feb 2018 01:56:11 +0100 Subject: Use Gitlab::CurrentSettings instead of current_application_settings --- app/models/project_auto_devops.rb | 4 +--- spec/features/admin/admin_settings_spec.rb | 4 ++-- spec/models/project_auto_devops_spec.rb | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb index f23310e854a..728e64e8fe3 100644 --- a/app/models/project_auto_devops.rb +++ b/app/models/project_auto_devops.rb @@ -1,6 +1,4 @@ class ProjectAutoDevops < ActiveRecord::Base - include Gitlab::CurrentSettings - belongs_to :project scope :enabled, -> { where(enabled: true) } @@ -9,7 +7,7 @@ class ProjectAutoDevops < ActiveRecord::Base validates :domain, allow_blank: true, hostname: { allow_numeric_hostname: true } def instance_domain - current_application_settings.auto_devops_domain + Gitlab::CurrentSettings.auto_devops_domain end def has_domain? diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 3da2f4e2fdb..39b213988f0 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -52,8 +52,8 @@ feature 'Admin updates settings' do fill_in 'Auto devops domain', with: 'domain.com' click_button 'Save' - expect(current_application_settings.auto_devops_enabled?).to be true - expect(current_application_settings.auto_devops_domain).to eq('domain.com') + expect(Gitlab::CurrentSettings.auto_devops_enabled?).to be true + expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com') expect(page).to have_content "Application settings saved successfully" end diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb index de90080b4b8..296b91a771c 100644 --- a/spec/models/project_auto_devops_spec.rb +++ b/spec/models/project_auto_devops_spec.rb @@ -20,7 +20,7 @@ describe ProjectAutoDevops do context 'when there is an instance domain specified' do before do - stub_application_setting(auto_devops_domain: 'example.com') + allow(Gitlab::CurrentSettings).to receive(:auto_devops_domain).and_return('example.com') end it { expect(auto_devops).to have_domain } @@ -28,7 +28,7 @@ describe ProjectAutoDevops do context 'when there is no instance domain specified' do before do - stub_application_setting(auto_devops_domain: nil) + allow(Gitlab::CurrentSettings).to receive(:auto_devops_domain).and_return(nil) end it { expect(auto_devops).not_to have_domain } @@ -52,7 +52,7 @@ describe ProjectAutoDevops do context 'when there is an instance domain specified' do before do - stub_application_setting(auto_devops_domain: 'example.com') + allow(Gitlab::CurrentSettings).to receive(:auto_devops_domain).and_return('example.com') end it { expect(auto_devops.variables).to include(domain_variable) } @@ -60,7 +60,7 @@ describe ProjectAutoDevops do context 'when there is no instance domain specified' do before do - stub_application_setting(auto_devops_domain: nil) + allow(Gitlab::CurrentSettings).to receive(:auto_devops_domain).and_return(nil) end it { expect(auto_devops.variables).not_to include(domain_variable) } -- cgit v1.2.1