Commit 5c156a4b authored by Robert Speicher's avatar Robert Speicher
Browse files

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
......@@ -13,6 +13,10 @@ def fake_application_settings(attributes = {})
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
......
......@@ -11,6 +11,10 @@ def initialize(options = {})
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|
......
......@@ -135,6 +135,10 @@
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
......
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