diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2024-01-15 15:03:29 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-01-29 12:19:31 +0900 |
commit | 355480dec6692b35b1404ef398da9360c02705b8 (patch) | |
tree | e16d020f17e08402662c865b88c318d2a53fe955 /spec | |
parent | 2956d3a5115fdbfb5591dcb63e482c24c9c175b9 (diff) |
[rubygems/rubygems] Properly restore empty env vars
https://github.com/rubygems/rubygems/commit/e0d68a8688
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/bundler/environment_preserver_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/bundler/bundler/environment_preserver_spec.rb b/spec/bundler/bundler/environment_preserver_spec.rb index 530ca6f835..6c7066d0c6 100644 --- a/spec/bundler/bundler/environment_preserver_spec.rb +++ b/spec/bundler/bundler/environment_preserver_spec.rb @@ -27,8 +27,12 @@ RSpec.describe Bundler::EnvironmentPreserver do context "when a key is empty" do let(:env) { { "foo" => "" } } - it "should not create backup entries" do - expect(subject).not_to have_key "BUNDLER_ORIG_foo" + it "should keep the original entry" do + expect(subject["foo"]).to be_empty + end + + it "should still create backup entries" do + expect(subject).to have_key "BUNDLER_ORIG_foo" end end @@ -71,8 +75,12 @@ RSpec.describe Bundler::EnvironmentPreserver do context "when the original key is empty" do let(:env) { { "foo" => "my-foo", "BUNDLER_ORIG_foo" => "" } } - it "should keep the current value" do - expect(subject["foo"]).to eq("my-foo") + it "should restore the original value" do + expect(subject["foo"]).to be_empty + end + + it "should delete the backup value" do + expect(subject.key?("BUNDLER_ORIG_foo")).to eq(false) end end end |