summaryrefslogtreecommitdiff
path: root/spec/ruby/core/hash/fetch_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/hash/fetch_spec.rb')
-rw-r--r--spec/ruby/core/hash/fetch_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/hash/fetch_spec.rb b/spec/ruby/core/hash/fetch_spec.rb
index 2fee5d0164..197832e311 100644
--- a/spec/ruby/core/hash/fetch_spec.rb
+++ b/spec/ruby/core/hash/fetch_spec.rb
@@ -8,6 +8,12 @@ describe "Hash#fetch" do
it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, {}
it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new { 5 }
it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new(5)
+
+ it "formats the object with #inspect in the KeyError message" do
+ -> {
+ {}.fetch('foo')
+ }.should raise_error(KeyError, 'key not found: "foo"')
+ end
end
it "returns the value for key" do