Chris Mear wrote in post #996234: > On 2 May 2011 00:58, Matt S. <li...@ruby-forum.com> wrote: >> accepts_nested_attributes_for.) >> before(:each) do >> end >> <%= f.fields_for :owner do |owner_fields| %> >> >> class AssetController < ApplicationController >> def new >> @asset = Asset.new >> @asset.build_owner >> end >> end > > Can you get the contents of 'response.body' from inside that spec > example, so we can see what's being rendered when the spec is run? > > Chris
Thanks Chis, Here is the rendered content: <h1>New asset</h1> <form accept-charset="UTF-8" action="/assets" class="new_asset" id="new_asset" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div> <div class="field"> <label for="asset_name">Name</label><br /> <input id="asset_name" name="asset[name]" size="30" type="text" value="Asset_#<RSpec::Core::ExampleGroup::Nested_2:0x00000004217d08>" /> </div> <h2>Owner</h2> <div class="actions"> <input id="asset_submit" name="commit" type="submit" value="Create Asset" /> </div> </form> <a href="/assets">Back</a> As you can see nothing comes up for the fields_for :owner block. I have tried stubbing owner_attributes and owner_attributes=, as your previously suggested, but I saw no change. It does seem that I need to mock something else on the assets model to get this to work. I have started combing through the the action_view source code but have not run into anything to get me on the right trail yet, although I have learned a lot about other things! If you want to see everything you can do a 'git clone git://github.com/matthewcalebsmith/asset_owner.git' to get the whole mock project, in case I have left out any pertinent details. Thank you! Matt Smith -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users