Open JonRowe opened 3 years ago
I had a similar one to this today:
class Foo
def bar(opts = {})
end
end
expect(foo).to receive(:bar).with(baz: "should-have-used-a-hash")
#<Double "Foo"> received :bar with unexpected arguments
expected: ({:baz=>"should-have-used-a-hash"})
got: ({:baz=>"should-have-used-a-hash"})
Diff:
Completely my mistake and it's correct but makes you think rspec is doing something funky at first glance. Would've been nice if the error could perhaps show *args vs **kwargs as the diff or something to help point you in the right direction.
When you call keyword argument methods with hashes (e.g. if a
method_missing
doesn't have a properruby2_keywords
call or a keyword splat) then the diff is confusing because it looks identical. This is going to be tricky to solve because to the differ, they are both hashes...Steps to reproduce
Possible/suggested behaviour
Actual behaviour