diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-08-02 14:58:21 +0530 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-08-06 13:09:26 +0530 |
commit | 9158de11caa767fe59c8d83d19ec568d9ade757e (patch) | |
tree | d28afc7ebf3bcd551a1d845887dd675c28df4238 | |
parent | 0a7ae4a24b4fbcb756cace701de8bf4640cdae46 (diff) | |
download | gitlab-ce-9158de11caa767fe59c8d83d19ec568d9ade757e.tar.gz |
Use ApplicationSetting.current_without_cache method
In order to avoid any problems with the cache when updating
ApplicationSettings.
-rw-r--r-- | app/services/self_monitoring/project/create_service.rb | 3 | ||||
-rw-r--r-- | spec/services/self_monitoring/project/create_service_spec.rb | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/app/services/self_monitoring/project/create_service.rb b/app/services/self_monitoring/project/create_service.rb index 03f74ef5cac..437a91ea18c 100644 --- a/app/services/self_monitoring/project/create_service.rb +++ b/app/services/self_monitoring/project/create_service.rb @@ -112,7 +112,8 @@ module SelfMonitoring end def application_settings - @application_settings ||= Gitlab::CurrentSettings.current_application_settings + @application_settings ||= ::ApplicationSetting.current_without_cache || + ::ApplicationSetting.create_from_defaults end def parse_url(uri_string) diff --git a/spec/services/self_monitoring/project/create_service_spec.rb b/spec/services/self_monitoring/project/create_service_spec.rb index d446b1bd198..2c53ef816d8 100644 --- a/spec/services/self_monitoring/project/create_service_spec.rb +++ b/spec/services/self_monitoring/project/create_service_spec.rb @@ -35,6 +35,7 @@ describe SelfMonitoring::Project::CreateService do let!(:user) { create(:user, :admin) } before do + allow(ApplicationSetting).to receive(:current_without_cache) { application_setting } application_setting.allow_local_requests_from_web_hooks_and_services = true end @@ -59,7 +60,7 @@ describe SelfMonitoring::Project::CreateService do end it 'creates project with internal visibility even when internal visibility is restricted' do - stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::INTERNAL]) + application_setting.restricted_visibility_levels = [Gitlab::VisibilityLevel::INTERNAL] expect(result[:status]).to eq(:success) expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL) |