-
Notifications
You must be signed in to change notification settings - Fork 54
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
raise_error
+ a block produces wrong failure message
#93
Comments
Hello @mcmire, maybe I bumped into this one today, here is a sample output from our JRuby project running on:
Failure/Error: expect { subject.call(service, request) }.to raise(Java::JavaxXmlWsSoap::SOAPFaultException) { expect(1).to eq(0) }
Expected raised exception #<RSpec::Expectations::ExpectationNotMetError "Expected \e[33m1\e[0m to eq \e[35m0\e[0m.">
to match #<Java::JavaxXmlWsSoap::SOAPFaultException> Is there any chance for you to fix it? Can I help somehow? Also wondering if this affects custom matchers which use nested |
I think in this case you might need to use |
Oh, I'm sorry, of course it's expect { raise 'x' }.to raise_error(RuntimeError) { |e| expect(e.message).to eq('x') } #=> true
expect { raise 'x' }.to raise_error(RuntimeError) { |e| expect(e.message).to eq('y') }
RSpec::Expectations::ExpectationNotMetError: Expected raised exception #<RSpec::Expectations::ExpectationNotMetError "Expected \e[33m\"x\"\e[0m to eq \e[35m\"y\"\e[0m.">
to match #<RuntimeError> |
Gotcha. 👍 Thanks for confirming this issue! |
raise_error
+ a block produces wrong failure message
When using raise_error with a block and the block contains an assertion, the generated failure message includes the full error message of that assertion.
The text was updated successfully, but these errors were encountered: