diff --git a/app/validators/url_validator.rb b/app/validators/url_validator.rb index c85f5ba5cdb6b095d7f31307879bccac198d2358..d3e32818dc7151f051803b3023e07c993c9373c9 100644 --- a/app/validators/url_validator.rb +++ b/app/validators/url_validator.rb @@ -93,6 +93,6 @@ def blocker_args end def allow_setting_local_requests? - Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services? + ApplicationSetting.current&.allow_local_requests_from_hooks_and_services? end end diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb index 97910e586760bf9b20efcf8b56675c05fc9ec307..caf9fc5442c4dcf808da1b7f09c5007c8888f40c 100644 --- a/spec/lib/gitlab/current_settings_spec.rb +++ b/spec/lib/gitlab/current_settings_spec.rb @@ -14,8 +14,9 @@ describe '#current_application_settings', :use_clean_rails_memory_store_caching do it 'allows keys to be called directly' do - db_settings = ApplicationSetting.first || create(:application_setting) - db_settings.update!(home_page_url: 'http://mydomain.com', signup_enabled: false) + db_settings = create(:application_setting, + home_page_url: 'http://mydomain.com', + signup_enabled: false) expect(described_class.home_page_url).to eq(db_settings.home_page_url) expect(described_class.signup_enabled?).to be_falsey @@ -108,7 +109,7 @@ def settings_from_defaults context 'with pending migrations' do before do - allow(ActiveRecord::Migrator).to receive(:needs_migration?).and_return(true) + expect(ActiveRecord::Migrator).to receive(:needs_migration?).and_return(true) end shared_examples 'a non-persisted ApplicationSetting object' do diff --git a/spec/models/lfs_download_object_spec.rb b/spec/models/lfs_download_object_spec.rb index 9e78d25ad33975ccd4214814b95db2ec543569c7..88838b127d2c43addc86c645e0d3413340a3c7c6 100644 --- a/spec/models/lfs_download_object_spec.rb +++ b/spec/models/lfs_download_object_spec.rb @@ -46,7 +46,9 @@ subject { described_class.new(oid: oid, size: size, link: 'http://192.168.1.1') } before do - stub_application_setting(allow_local_requests_from_hooks_and_services: setting) + allow(ApplicationSetting) + .to receive(:current) + .and_return(ApplicationSetting.build_from_defaults(allow_local_requests_from_hooks_and_services: setting)) end context 'are allowed' do