summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-09-10 11:48:09 +0200
committerRémy Coutable <remy@rymai.me>2018-09-10 11:48:09 +0200
commit3bf1cd5780fc6f08eac8046c8a6b475b8f7f30b7 (patch)
treef35b6cf6c41b30d41641baae254570923ff20062
parenta5517ada119a0e73e0a70fd18e11fda3932138e8 (diff)
downloadgitlab-ce-3bf1cd5780fc6f08eac8046c8a6b475b8f7f30b7.tar.gz
Ensure in-memory application settings are cleared before each test
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--lib/gitlab/current_settings.rb4
-rw-r--r--spec/spec_helper.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index 9147ef401da..8eba8edb46d 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!
+ instance_variable_set(:@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/spec/spec_helper.rb b/spec/spec_helper.rb
index c4bb1c13f2e..d1337325973 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -135,6 +135,10 @@ RSpec.configure do |config|
Fog.unmock! if Fog.mock?
end
+ config.after(:example) do
+ Gitlab::CurrentSettings.clear_in_memory_application_settings!
+ end
+
config.before(:example, :mailer) do
reset_delivered_emails!
end