fixing behavior of load_and_authorize_resource for namespaced controllers - closes #3

This commit is contained in:
Ryan Bates
2009-11-17 11:59:59 -08:00
parent 766fe86a9f
commit 15a01a579c
3 changed files with 14 additions and 3 deletions

View File

@@ -82,4 +82,11 @@ describe CanCan::ControllerAdditions do
stub(@controller).authorize_resource
@controller.load_and_authorize_resource
end
it "should properly load resource for namespaced controller" do
stub(@controller).params { {:controller => "admin/abilities", :action => "show", :id => 123} }
stub(Ability).find(123) { :some_resource }
@controller.load_resource
@controller.instance_variable_get(:@ability).should == :some_resource
end
end