improve support for rspec scaffolding (thanks voxik) - closes #176

This commit is contained in:
Ryan Bates
2010-12-21 14:18:20 -08:00
parent 5e1e6e182b
commit 4339ac6546
2 changed files with 6 additions and 8 deletions

View File

@@ -245,7 +245,7 @@ describe CanCan::ControllerResource do
@params.merge!(:action => "create", :project => {:name => "foobar"})
category = Object.new
@controller.instance_variable_set(:@category, category)
stub(category).build_project { Project.new }
stub(category).build_project { |attributes| Project.new(attributes) }
resource = CanCan::ControllerResource.new(@controller, :through => :category, :singleton => true)
resource.load_resource
@controller.instance_variable_get(:@project).name.should == "foobar"