[rspec-users] Problem with Before Filters

David Chelimsky dchelimsky at gmail.com
Mon Dec 14 14:22:32 EST 2009


On Mon, Dec 14, 2009 at 1:05 AM, Amit Kulkarni <lists at ruby-forum.com> wrote:
> Thanks David,
> Now in spec when i write login_as :admin then there must be some method
> written for login_as?

That would be a helper that you write yourself or is provided by the
authentication framework you're using. It lives in the spec suite, not
in the controller code, and does whatever is necessary to either
actually log in. The most black box approach is to post to the
controller that manages logging in.

What it looks like depends on how you design your authentication
system. restful_authentication, for example, ships with login_as and
authorize_as methods that set session variables directly.

HTH,
David


More information about the rspec-users mailing list