On Friday, April 27, 2012 8:13:59 AM UTC-5, Christophe Porteneuve wrote:
>
> I get your point about expectations on objects undergoing test, but then 
> I wonder what's the best way to go about it when you want to test a 
> specific method in isolation of its same-object-method dependencies?


Stub the collaborators, but not the methods on the object under test.
 

>  I 
> don't recall having seen such warnings in the RSpec book (but, granted, 
> I read that quite a while ago). 
>

They're there.
 

> Also, I don't believe the "hidden re-instanciation" is the issue at play 
> here, as I'm not doing anything between @product.should_receive and 
> @product.min_money(�).should. 
>
> However, the logs tell me the AR instanciation actually happens AFTER my 
> '1>' marker, so perhaps you're right, but then why can't I rely on the 
> before block being actually run, AR-wise, BEFORE my description?! 
>

before blocks are absolutely 100% without a doubt run before the example. I 
think Rails logging is asynchronous, but having trouble locating relevant 
docs. Try puts statements instead.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rspec/-/PWoZvbdO6bEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rspec?hl=en.

Reply via email to