You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A better approach is to include RSpec::Matchers::Composable; it defines the === alias and provides some other functionality to help use the matcher in composable fashion.
I agree the docs could be improved, though....want to open a PR to improve it?
We may want to link to the matcher protocol that was add in #567.
That would be good. I also think the examples should be updated to show that we recommend including RSpec::Matchers::Composable as it's intended to be mixed into every matcher class so that it supports the full composability features of matchers in RSpec 3.
When creating a custom matcher and using it with a mock argument expectation, the
===
method should also be defined, otherwise, the match will fail.Example:
Documentation here - http://rubydoc.info/github/rspec/rspec-expectations/RSpec/Matchers
Under Custom Matcher from scratch
Add this code to the class:
Alternatively, rspec-mocks should see if this is a matcher and use
matches?
.The text was updated successfully, but these errors were encountered: