Matt S. wrote in post #991032:
>> In similar view specs, I've stubbed #owner_attributes= on the 'assets'
>> mock. I think Rails' nested form/assignment implementation does a
>> check on the existence of this method to make sure that the Asset
>> model does indeed accept nested assignment for that attribute.
>>
>> Chris
>
> Thanks Chris,
>
> I'll give that a try and post my solution.
>
> Matt
Well it appears I am still stumped...
If I change Asset to:
class Asset < ActiveRecord::Base
belongs_to :owner
accepts_nested_attributes_for :owner
def owner_attributes=(attributes)
#test
end
end
The new form works in the browser, but not in the test. If I change my
before block to the following (and eliminate the def owner_attributes=),
the test still fails.
before(:each) do
asset.stub(:owner => owner)
asset.stub(:owner_attributes=).with(anything()) # new line
assign(:asset, asset)
end
Any thoughts? Am I stubbing this incorrectly?
Much thanks, Matt
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users