[rspec-users] Testing variables in controllers?

Fernando Perez lists at ruby-forum.com
Thu Nov 6 10:39:08 EST 2008


Ramon Tayag wrote:
> How do you test that your controller fetched the right records?
> 
> I have an action that returns a different set of records based on
> whether or not the current_user is the "owner" of the profile being
> viewed.
> 
> Code is here http://pastie.org/308685.
> 
> "controller.submissions.size.should == 1" makes sense but it doesn't
> work.  Of course, I might be doing this wrong altogether!  Very new to
> rspec.
> 
> Thanks!
> Ramon Tayag

>From what I read and my little experience with rpsec, you shouldn't test 
for the exact return values. This kind of test should be done when 
testing the model alone.
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list