diff options
author | Robert Speicher <robert@gitlab.com> | 2018-09-11 01:38:12 +0300 |
---|---|---|
committer | Thiago Presa <tpresa@gitlab.com> | 2018-09-11 03:22:46 +0300 |
commit | 1c2553abc565d383a11130f8dfff19ff4fce6841 (patch) | |
tree | 21e197b3f61c32938fd901a34d1203fb93db2080 /lib | |
parent | dcc08d3533befe79258406375e9f1adbd1b56583 (diff) |
Merge branch '51268-clear-in-memory-application-settings-between-examples' into 'master'
Resolve "Changes in in-memory application settings in one spec can break another spec"
Closes #51268
See merge request gitlab-org/gitlab-ce!21638
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/current_settings.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/fake_application_settings.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 9147ef401da..c9dbd2d2e5f 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -13,6 +13,10 @@ module Gitlab Gitlab::FakeApplicationSettings.new(::ApplicationSetting.defaults.merge(attributes || {})) end + def clear_in_memory_application_settings! + @in_memory_application_settings = nil + end + def method_missing(name, *args, &block) current_application_settings.send(name, *args, &block) # rubocop:disable GitlabSecurity/PublicSend end diff --git a/lib/gitlab/fake_application_settings.rb b/lib/gitlab/fake_application_settings.rb index bb14a8cd9e7..753160cc562 100644 --- a/lib/gitlab/fake_application_settings.rb +++ b/lib/gitlab/fake_application_settings.rb @@ -11,6 +11,10 @@ module Gitlab FakeApplicationSettings.define_predicate_methods(options) end + def pick_repository_storage + repository_storages.sample + end + # Mimic ActiveRecord predicate methods for boolean values def self.define_predicate_methods(options) options.each do |key, value| |