Skip to content

Commit 5c25e5e

Browse files
committed
Add spec for **42
1 parent d00685b commit 5c25e5e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/ruby/language/hash_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ def h.to_hash; {:b => 2, :c => 3}; end
149149
-> { {**obj} }.should raise_error(TypeError)
150150
end
151151

152+
it "raises a TypeError if the object does not respond to #to_hash" do
153+
obj = 42
154+
-> { {**obj} }.should raise_error(TypeError)
155+
-> { {a: 1, **obj} }.should raise_error(TypeError)
156+
end
157+
152158
it "does not change encoding of literal string keys during creation" do
153159
binary_hash = HashStringsBinary.literal_hash
154160
utf8_hash = HashStringsUTF8.literal_hash

0 commit comments

Comments
 (0)