diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-11-30 21:26:52 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-11-30 21:26:52 +0100 |
commit | 1243255c3a36433041012b6107a5ac48658a0895 (patch) | |
tree | 04440f84b48999ff08d4a2a16d066d0ad731400e /spec/ruby/core/env/shared/to_hash.rb | |
parent | ab8345271eb87ff155d8bd5f22f53a4cf2902c26 (diff) |
Update to ruby/spec@4eec3dc
Diffstat (limited to 'spec/ruby/core/env/shared/to_hash.rb')
-rw-r--r-- | spec/ruby/core/env/shared/to_hash.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/ruby/core/env/shared/to_hash.rb b/spec/ruby/core/env/shared/to_hash.rb index 254054c14d..bfa5699e8d 100644 --- a/spec/ruby/core/env/shared/to_hash.rb +++ b/spec/ruby/core/env/shared/to_hash.rb @@ -1,10 +1,17 @@ describe :env_to_hash, shared: true do + before :each do + @saved_foo = ENV["foo"] + end + + after :each do + ENV["foo"]= @saved_foo + end + it "returns the ENV as a hash" do ENV["foo"] = "bar" h = ENV.send(@method) h.should be_an_instance_of(Hash) h["foo"].should == "bar" - ENV.delete "foo" end it "uses the locale encoding for keys" do @@ -18,5 +25,9 @@ describe :env_to_hash, shared: true do it "duplicates the ENV when converting to a Hash" do h = ENV.send(@method) h.should_not equal ENV + h.size.should == ENV.size + h.each_pair do |k, v| + ENV[k].should == v + end end end |