[rspec-users] Question: Define custom matcher like raise_error, by Matchers.define

Kaoru Kobo pub at kaorukobo.net
Thu Nov 25 19:30:22 EST 2010

Thanks, David.

> This should work:
> ...
> match do |block|
>  (block.call; true) rescue false
> end

I tried that, but the spec still fails...

'The expectation failure in block called from the custom matcher  
should be reported.' FAILED
expected no Exception with message matching /be_done failed/, got  
#<Spec::Expectations::ExpectationNotMetError: be_done failed.>

I expect that it fails with message 'expected: 2, got: 1 (using ==)'.

Best Regards.
Kaoru Kobo

More information about the rspec-users mailing list