diff options
Diffstat (limited to 'spec/ruby/core/env/fetch_spec.rb')
-rw-r--r-- | spec/ruby/core/env/fetch_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/env/fetch_spec.rb b/spec/ruby/core/env/fetch_spec.rb index ea9995a3b0..c8a11430ab 100644 --- a/spec/ruby/core/env/fetch_spec.rb +++ b/spec/ruby/core/env/fetch_spec.rb @@ -14,6 +14,12 @@ describe "ENV.fetch" do context "when the key is not found" do it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, ENV + + it "formats the object with #inspect in the KeyError message" do + -> { + ENV.fetch('foo') + }.should raise_error(KeyError, 'key not found: "foo"') + end end it "provides the given default parameter" do |