Yan,

The "better whine" is actually a very compelling argument, *in principle*. 
But I don't see how it can actually work. E.g.

*  it 'works' do*
*    f = double*
*    f.should_receive(:bar) { 42 }*
*    result = 1*
*    # Some dumb engineer commented out the line where we compute the value!
*
*    # result += f.bar*
*    expect(result).to eq 43*
*  end*

This fails because someone commented out the part where we add f.bar to 
result. But the failure doesn't tell us that the code failed to call f.bar. 
It just says:

*expected: 43*
*     got: 1*
*
*
*(compared using ==)*


So the API I'd like to see is:

- Mocks cannot return values.
- If you want to assert that something is cached (i.e. it shouldn't be 
called more than once) then then do something like 
double.stub(:foo).with(42)*.cache*

Not particularly optimistic that this change will be implemented in my 
lifetime. :)

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rspec/-/f66MAU-oSKIJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to