summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-06-23 21:01:32 -0700
committerStan Hu <stanhu@gmail.com>2017-06-26 08:13:46 -0700
commit1a47bd37a1bc4b33980ba0c97bae9ba54b8d2cfb (patch)
tree60e124b311a8335f358dff2d56eb73a2b7406224 /spec
parent47face017562b160dba2c9bb5d7b9e75f605f721 (diff)
downloadgitlab-ce-1a47bd37a1bc4b33980ba0c97bae9ba54b8d2cfb.tar.gz
Reset the state of StubENV's @env_already_stubbed after each spec runsh-unset-stubenv
In certain combination of tests, @env_already_stubbed could be set to `true` even though it never ran for that specific test.
Diffstat (limited to 'spec')
-rw-r--r--spec/support/stub_env.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/support/stub_env.rb b/spec/support/stub_env.rb
index 18597b5c71f..2999bcd9fb1 100644
--- a/spec/support/stub_env.rb
+++ b/spec/support/stub_env.rb
@@ -5,3 +5,11 @@ module StubENV
allow(ENV).to receive(:[]).with(key).and_return(value)
end
end
+
+# It's possible that the state of the class variables are not reset across
+# test runs.
+RSpec.configure do |config|
+ config.after(:each) do
+ @env_already_stubbed = nil
+ end
+end