fixing spec for new id_param option

This commit is contained in:
Ryan Bates 2011-09-28 13:50:46 -07:00
parent 67c93619c1
commit eafd6cfcde

View File

@ -325,15 +325,15 @@ describe CanCan::ControllerResource do
lambda { resource.process }.should raise_error(CanCan::Unauthorized) lambda { resource.process }.should raise_error(CanCan::Unauthorized)
@controller.instance_variable_get(:@custom_project).should == project @controller.instance_variable_get(:@custom_project).should == project
end end
it "should load resource using custom ID param" do it "should load resource using custom ID param" do
project = Project.create! project = Project.create!
@params.merge!(:action => "show", :the_project => project.id) @params.merge!(:action => "show", :the_project => project.id)
resource = CanCan::ControllerResource.new(@controller, :id_param => :the_project) resource = CanCan::ControllerResource.new(@controller, :id_param => :the_project, :load => true)
resource.load_resource resource.process
@controller.instance_variable_get(:@project).should == project @controller.instance_variable_get(:@project).should == project
end end
it "should load resource using custom find_by attribute" do it "should load resource using custom find_by attribute" do
project = Project.create!(:name => "foo") project = Project.create!(:name => "foo")
@params.merge!(:action => "show", :id => "foo") @params.merge!(:action => "show", :id => "foo")