[rspec-users] Controller spec: testing that scope is set

Pat Maddox pat.maddox at gmail.com
Mon Apr 20 15:41:51 EDT 2009

In a functional test, create some records that will be in the scope
and some that will be out of the scope, hit the page and make sure you
only see the ones that you want.  I would either do this with
cucumber, or write a controller spec and verify that only certain
records show in the the assigns var.  Either way you're going to have
to hit the db because obviously the scope affects the db queries.
This is why you'd typically like to keep that stuff in the model.


On Sun, Apr 19, 2009 at 9:27 AM, Michael Schuerig <michael at schuerig.de> wrote:
> In a Rails controller I set the scope on a model class in an around
> filter. I have defined expectations on the model classes, and ideally, I
> would add a further expectation for the scope. Is this already possible
> in some way? How would I go about adding support a scope expectation?
> Michael
> --
> Michael Schuerig
> mailto:michael at schuerig.de
> http://www.schuerig.de/michael/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list