Commit 6025b4e8 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'use_gitlab_current_settings' into 'master'

Use Gitlab::CurrentSettings in UrlValidator

See merge request gitlab-org/gitlab-ce!25370
parents 1b5e3b2e 8a1b6041
...@@ -93,6 +93,6 @@ class UrlValidator < ActiveModel::EachValidator ...@@ -93,6 +93,6 @@ class UrlValidator < ActiveModel::EachValidator
end end
def allow_setting_local_requests? def allow_setting_local_requests?
ApplicationSetting.current&.allow_local_requests_from_hooks_and_services? Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services?
end end
end end
...@@ -14,9 +14,8 @@ describe Gitlab::CurrentSettings do ...@@ -14,9 +14,8 @@ describe Gitlab::CurrentSettings do
describe '#current_application_settings', :use_clean_rails_memory_store_caching do describe '#current_application_settings', :use_clean_rails_memory_store_caching do
it 'allows keys to be called directly' do it 'allows keys to be called directly' do
db_settings = create(:application_setting, db_settings = ApplicationSetting.first || create(:application_setting)
home_page_url: 'http://mydomain.com', db_settings.update!(home_page_url: 'http://mydomain.com', signup_enabled: false)
signup_enabled: false)
expect(described_class.home_page_url).to eq(db_settings.home_page_url) expect(described_class.home_page_url).to eq(db_settings.home_page_url)
expect(described_class.signup_enabled?).to be_falsey expect(described_class.signup_enabled?).to be_falsey
...@@ -109,7 +108,7 @@ describe Gitlab::CurrentSettings do ...@@ -109,7 +108,7 @@ describe Gitlab::CurrentSettings do
context 'with pending migrations' do context 'with pending migrations' do
before do before do
expect(ActiveRecord::Migrator).to receive(:needs_migration?).and_return(true) allow(ActiveRecord::Migrator).to receive(:needs_migration?).and_return(true)
end end
shared_examples 'a non-persisted ApplicationSetting object' do shared_examples 'a non-persisted ApplicationSetting object' do
......
...@@ -46,9 +46,7 @@ describe LfsDownloadObject do ...@@ -46,9 +46,7 @@ describe LfsDownloadObject do
subject { described_class.new(oid: oid, size: size, link: 'http://192.168.1.1') } subject { described_class.new(oid: oid, size: size, link: 'http://192.168.1.1') }
before do before do
allow(ApplicationSetting) stub_application_setting(allow_local_requests_from_hooks_and_services: setting)
.to receive(:current)
.and_return(ApplicationSetting.build_from_defaults(allow_local_requests_from_hooks_and_services: setting))
end end
context 'are allowed' do context 'are allowed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment