Given receiver has a method foo(first_name:, last_name:)
We could check for calls to that with:
Use a hash_including Matcher:
expect(receiver).to receive(:foo).with(hash_including(first_name: "Alan"))
Mention every keyword argument in the expectation:
expect(receiver).to receive(:foo).with(first_name: "Alan", last_name: anything)
Is there a way to match "just a few keywords"?
- Perhaps locally aliasing hash_including to keywords_including
Anyone got anything else? Is this a real wart, or is it something that'll be invisible to the reader after they've fully entered Ruby 3?
Thanks for considering this very minor issue!