diff --git a/spec/support/stub_env.rb b/spec/support/stub_env.rb
index 18597b5c71f7c481fc4bfef64c9494cb7f9452e7..2999bcd9fb15b299c42d67398d393f8167f6f609 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