diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-10-26 20:53:01 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-10-26 20:53:01 +0200 |
commit | 664e96b1de816c813c29f61e16a2031a7af7ba86 (patch) | |
tree | 7f4691847cd6b3282812eea7e2be3758e08d1433 /spec/ruby/core/env/assoc_spec.rb | |
parent | 3eb0d50c0baae916f4486c264605b18e77bee0dc (diff) | |
download | ruby-664e96b1de816c813c29f61e16a2031a7af7ba86.tar.gz |
Update to ruby/spec@28a728b
Diffstat (limited to 'spec/ruby/core/env/assoc_spec.rb')
-rw-r--r-- | spec/ruby/core/env/assoc_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/ruby/core/env/assoc_spec.rb b/spec/ruby/core/env/assoc_spec.rb index 853eca79a5..9946e328a9 100644 --- a/spec/ruby/core/env/assoc_spec.rb +++ b/spec/ruby/core/env/assoc_spec.rb @@ -1,8 +1,12 @@ require_relative '../../spec_helper' describe "ENV.assoc" do + before :each do + @foo = ENV["foo"] + end + after :each do - ENV.delete("foo") + ENV["foo"] = @foo end it "returns an array of the key and value of the environment variable with the given key" do @@ -20,4 +24,8 @@ describe "ENV.assoc" do k.should_receive(:to_str).and_return("foo") ENV.assoc(k).should == ["foo", "bar"] end + + it "raises TypeError if the argument is not a String and does not respond to #to_str" do + -> { ENV.assoc(Object.new) }.should raise_error(TypeError) + end end |