[rspec-users] Where is current_user?

Harry Bishop lists at ruby-forum.com
Tue Oct 21 22:39:09 EDT 2008


Thanks David,
Your method works well and rspec succeeds now.

Is the preferred way of using code with rspec to not rely on instance 
variables set in a parent during execution but to rely on the method 
only construct to be able to interact?

I see the way this works for the outline you provided.  I am wondering 
what the implications are with respect to writing ruby code with the 
assumption parent instance variables will be inherited by children.  The 
approach you are providing would indicate that an attr_read method is 
preferred so that the retrieve method can be stubbed since the instance 
variable doesn't get set when tested.

Is this a general rule of practice with rspec?  As a beginner I'm trying 
to get the larger picture here and appreciate your insight with this.

HR


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


More information about the rspec-users mailing list