Skip to content

Commit

Permalink
cancan 2.0 fix for issue ryanb#565; test to properly authorize resour…
Browse files Browse the repository at this point in the history
…ce for namespaced controller
  • Loading branch information
bsodmike committed May 11, 2012
1 parent 48ed6f9 commit 0e8c7ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/cancan/controller_resource_spec.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 0e8c7ca

Please sign in to comment.