Skip to content

Commit

Permalink
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/ruby/language/hash_spec.rb
Original file line number Diff line number Diff line change
@@ -128,6 +128,11 @@
{a: 1, **obj, c: 3}.should == {a:1, b: 2, c: 3, d: 4}
end

it "raises a TypeError if any splatted elements keys are not symbols" do
h = {1 => 2, b: 3}
lambda { {a: 1, **h} }.should raise_error(TypeError)
end

it "raises a TypeError if #to_hash does not return a Hash" do
obj = mock("hash splat")
obj.should_receive(:to_hash).and_return(obj)

0 comments on commit d2aa169

Please sign in to comment.