Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cancan 2.0 fix for issue #565; test to properly authorize resource fo…

…r namespaced controller
  • Loading branch information...
commit 0e8c7ca01f633d238d9ad44151390cc619e75e8d 1 parent 48ed6f9
@bsodmike authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 spec/cancan/controller_resource_spec.rb
View
8 spec/cancan/controller_resource_spec.rb
@@ -384,6 +384,14 @@ class Project < ::Project; end
@controller.instance_variable_get(:@project).name.should == "foobar"
end
+ it "should properly authorize resource for namespaced controller" do
+ @ability.can(:index, "admin/dashboard")
+ @params.merge!(:controller => "admin/dashboard", :action => "index")
+ @controller.authorize!(:index, "admin/dashboard")
+ resource = CanCan::ControllerResource.new(@controller, :authorize => true).process
+ lambda { resource.process }.should_not raise_error(CanCan::Unauthorized)
+ end
+
# it "raises ImplementationRemoved when adding :name option" do
# lambda {
# CanCan::ControllerResource.new(@controller, :name => :foo)
Please sign in to comment.
Something went wrong with that request. Please try again.