summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/ruby_version_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/bundler/ruby_version_spec.rb')
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb
index 46a1b2918b..3ac7d9ef3a 100644
--- a/spec/bundler/bundler/ruby_version_spec.rb
+++ b/spec/bundler/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