I'd love there to be a `keywords_including` matcher here, `hash_including` 
works on some Rubies but it doesn't check that they are actually keywords, 
leaving that up to `with` itself, we can actually check if its a keywords 
hash we're inspecting though.

Cheers
Jon

On Wednesday, 24 August 2022 at 08:21:34 UTC+1 [email protected] wrote:

> Hello,
>
> 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"?
>
> Weak ideas:
> - 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!
>
>     /Olle
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/cf19543f-7fa4-4397-b939-49c99c9dc8e1n%40googlegroups.com.

Reply via email to