[rspec-users] restful_authentication's "permission_denied" and rspec

David Chelimsky dchelimsky at gmail.com
Sun Nov 23 06:25:31 EST 2008

On Fri, Nov 21, 2008 at 8:20 AM, Ramon Tayag <ramon.tayag at gmail.com> wrote:
> Hi everyone,
> WIth restful_authentication you get a method "permission_denied" that
> you just slap onto the controller when you don't want a user to gain
> access to something.  In this method Rails does a bunch of stuff then
> basically tries to be smart and redirects the user somewhere else.
> I want to test that this occurs given certain conditions but I don't
> know how to "should_receive" this or something.
> This definitely doesn't work but it should explain what I'm trying to do:
> controller.should_receive(:permission_denied)

Please post code (the spec and controller code - AND the error
message) when you ask questions like this because it's very difficult
to help you with the little bit of information you've provided.

Without seeing any code, if the method is on the controller, then you
should be able to say controller.should_receive(:permission_denied).

> How would I go about this?
> Thank you,
> 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