Merge branch 'master' into 2.0

This commit is contained in:
Ryan Bates
2011-09-28 13:45:49 -07:00
2 changed files with 15 additions and 3 deletions
+9 -1
View File
@@ -325,7 +325,15 @@ describe CanCan::ControllerResource do
lambda { resource.process }.should raise_error(CanCan::Unauthorized)
@controller.instance_variable_get(:@custom_project).should == project
end
it "should load resource using custom ID param" do
project = Project.create!
@params.merge!(:action => "show", :the_project => project.id)
resource = CanCan::ControllerResource.new(@controller, :id_param => :the_project)
resource.load_resource
@controller.instance_variable_get(:@project).should == project
end
it "should load resource using custom find_by attribute" do
project = Project.create!(:name => "foo")
@params.merge!(:action => "show", :id => "foo")