summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-23 23:15:01 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-27 13:03:21 +0200
commita0584faa5df94527f48adbd252bcf40080a90223 (patch)
treedca4b73c2d302cd6fcf939c176c1793f0b3232af
parente66356c316b092864f114fb006772266e8ca4a58 (diff)
downloadbundler-a0584faa5df94527f48adbd252bcf40080a90223.tar.gz
Fix another state leak in the test suite
Reproducible with ``` bin/rspec \ ./spec/bundler/ruby_version_spec.rb[1:1:8:5:3:1] \ ./spec/install/gemfile/ruby_spec.rb[1:4] \ --seed 48267 ```
-rw-r--r--spec/bundler/ruby_version_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/bundler/ruby_version_spec.rb b/spec/bundler/ruby_version_spec.rb
index 46a1b2918b..3ac7d9ef3a 100644
--- a/spec/bundler/ruby_version_spec.rb
+++ b/spec/bundler/ruby_version_spec.rb
@@ -399,8 +399,14 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
let(:bundler_system_ruby_version) { subject }
- before do
- Bundler::RubyVersion.instance_variable_set("@ruby_version", nil)
+ around do |example|
+ begin
+ old_ruby_version = Bundler::RubyVersion.instance_variable_get("@ruby_version")
+ Bundler::RubyVersion.instance_variable_set("@ruby_version", nil)
+ example.run
+ ensure
+ Bundler::RubyVersion.instance_variable_set("@ruby_version", old_ruby_version)
+ end
end
it "should return an instance of Bundler::RubyVersion" do