Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arbitary matchers to be used with parameter matcher. #634

Open
rayward opened this issue Jan 15, 2018 · 2 comments
Open

Allow arbitary matchers to be used with parameter matcher. #634

rayward opened this issue Jan 15, 2018 · 2 comments

Comments

@rayward
Copy link

rayward commented Jan 15, 2018

It'd be great if the built-in rspec matchers (or anything that conforms to the protocol - https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/matcher_protocol.rb) could be used when testing a class parameter.

I have class that takes a complex hash as one of its parameters, I'd like to test that this hash includes a particular key/value under a certain context.

Right now I have to convert the include matcher to a proc to make this work:

is_expected.to contain_class('foo').with_settings(include('hello' => 'world').method(:matches?).to_proc)

I'd be nice if this matcher could be composed in a more fluid manner.

@rodjek
Copy link
Owner

rodjek commented Jan 15, 2018

@rayward I'm not planning on changing the matcher API significantly in 2.x, but using the built in matchers is planned for 3.x

@rayward
Copy link
Author

rayward commented Jan 15, 2018

Awesome, great to hear its already coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants