[rspec-users] Testing variables in controllers?
Matt Wynne
matt at mattwynne.net
Thu Nov 6 10:37:34 EST 2008
woah!
You're exposing way too much of your model here, IMO. That is forcing
you to do all that noisy mocking setup in your before block.
Can you make a method on your user object like User#valid_submissions
and have that return the correct submissions?
How do you know whether the user is the profile owner?
On 6 Nov 2008, at 14:36, 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
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list