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

match_when_negated does not handle expectation failures like match does #788

Closed
myronmarston opened this issue May 12, 2015 · 0 comments · Fixed by #789
Closed

match_when_negated does not handle expectation failures like match does #788

myronmarston opened this issue May 12, 2015 · 0 comments · Fixed by #789
Labels

Comments

@myronmarston
Copy link
Member

The definition of match in the matcher DSL rescues ExpectationNotMetError and returns false, allowing expectations to be used in match blocks:

rescue RSpec::Expectations::ExpectationNotMetError
false

However, match_when_negated does not do this:

def match_when_negated(&match_block)
define_user_override(:does_not_match?, match_block) do |actual|
@actual = actual
super(*actual_arg_for(match_block))
end
end

This should be fixed, as these two methods should have parity with respect to how expectation failures are treated.

Note that I'm currently working on some edits in this area as part of #776 so whoever works on this may want to hold off until that PR is merged to reduce the likliehood of merge conflicts.

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