[rspec-users] how can this pass?

Sergio Bayona lists at ruby-forum.com
Sun Feb 8 21:54:36 EST 2009

Aslak Hellesøy wrote:
> On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona <lists at ruby-forum.com> 
> wrote:
>>        assigns[:property].should equal(mock_property)
>> 1 example, 0 failures
>> why zero failures? more specifically, why would :non_existing_method
>> return mock_property?
> Because you have stubbed the class method Property#non_existing_method 
> with:
>   Property.should_receive(:non_existing_method).and_return(mock_property)
> It doesn't make any difference whether this method is already defined
> or not. Once the stub is set up, calls to the stubbed method will
> return what you told it to return.
>> and why would the assigns[:property] be equal to
>> mock_property?
> Because your controller's #show method assigns @property with the
> value returned from Property#non_existing_method (which you stubbed).
>> did I eat some bad mushrooms?
> That I don't know. Why do you think this behaviour is 
> strange/hallucinating?
> Aslak

ah! okay it's starting to make sense... and the mushroom effect is 
wearing out. just kidding ;)

Thank you guys. By the way I just bought the "Rspec Book" and it's seems 
like a great resource. It has encouraged me to learn the framework.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list