diff options
author | Steve Azzopardi <sazzopardi@gitlab.com> | 2018-11-20 08:23:36 +0000 |
---|---|---|
committer | Steve Azzopardi <sazzopardi@gitlab.com> | 2018-11-20 08:23:36 +0000 |
commit | 91221cd73edca9d7923fb7acf820acc2c49a8b2a (patch) | |
tree | 810a156060028987404d2a61e44078dc3fbf5e17 | |
parent | 3b23d06cbee9fb36014e86dee532c858e5f20cca (diff) | |
parent | 1bac28d0a94b8dcc5e105b3085aa5061ec3c050b (diff) | |
download | gitlab-ce-91221cd73edca9d7923fb7acf820acc2c49a8b2a.tar.gz |
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
-rw-r--r-- | spec/support/helpers/devise_helpers.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/support/helpers/devise_helpers.rb b/spec/support/helpers/devise_helpers.rb index 66874e10f38..d32bc2424c0 100644 --- a/spec/support/helpers/devise_helpers.rb +++ b/spec/support/helpers/devise_helpers.rb @@ -8,8 +8,15 @@ module DeviseHelpers 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 |