I have a function being called like
car.method({a: 3, b: 6, c: 9})
And in RSpec, I want to assert that b: 6 is called, but not any of the other values.
expect(car).to receive(:method).with({b: 6})
How can I do that without strictly matching the entire object?
答案 0 :(得分:2)
If I right understand your question, it may write like this (from relishapp.com):
expect(car).to receive(:method).with(hash_including(b: 6))
Anyway, see matching arguments from this source, it can help to resolve your problem.