Skip to content
Snippets Groups Projects
Unverified Commit 6a54856c authored by Steve Azzopardi's avatar Steve Azzopardi Committed by Steve Azzopardi
Browse files

Merge branch 'sh-fix-issue-8448-ce' into 'master'

Stub Rails.application.env_config to prevent spec failures

Closes gitlab-ee#8488

See merge request gitlab-org/gitlab-ce!23222
parent 5b8a51a9
No related merge requests found
......@@ -8,8 +8,15 @@ def set_devise_mapping(context:)
end
def env_from_context(context)
# When we modify env_config, that is on the global
# Rails.application, and we need to stub it and allow it to be
# modified in-place, without polluting later tests.
if context.respond_to?(:env_config)
context.env_config
context.env_config.deep_dup.tap do |env|
allow(context).to receive(:env_config).and_return(env)
end
# When we modify env, then the context is a request, or something
# else that only lives for a single spec.
elsif context.respond_to?(:env)
context.env
end
......
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