On 25 Aug 2009, at 20:59, Chuck Remes wrote:
The documentation says the expectation passes or fails based upon
the return value of the block. I can't even force it to fail by
returning false.
The docs (http://rspec.info/documentation/mocks/message_expectations.html
) say:
You can supply a block to a message expectation. When the message is
received
by the mock, the block is passed any arguments and evaluated. The
result is
the return value of the block.
This means that the mocked method will return the value that is
returned by the block; by returning false in your block, you're just
arranging for the mocked method to return false. (So this is the same
as @api.should_receive(:publish_to_bus).and_return(false).)
If you want the message expectation to fail, you need to put a failing
expectation inside the block.
Cheers,
-Tom
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users