[rspec-users] odd mock behavior
dchelimsky at gmail.com
Wed Feb 7 12:45:44 EST 2007
On 2/7/07, Micah Martin <micah at 8thlight.com> wrote:
> I'm seeing some odd behavior around the should_receive() when given a block
> combined with some cardinality.
> For example, with the following...
> my_mock.should_receive(:foo).twice do |i|
> puts i
Blocks aren't currently supported in any form besides:
Since none of the other methods (#with, #once, #twice, etc) deal with
a block, the block is never being invoked.
Feel free to submit an RFE if you feel this should be supported.
> ... the spec passes but i never gets puts'ed.
> With the following...
> my_mock.should_receive(:foo) do |i|
> puts i
> ... i gets puts'ed twice but the spec fails because it was only expecting
> one call to :foo.
> Micah Martin
> 8th Light, Inc.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users