Hi,<div><br class="webkit-block-placeholder"></div><div>I have the following example:</div><div><br class="webkit-block-placeholder"></div><div><div> it 'should have a form with an action attribute' do </div><div>
response.should have_tag( "form[action=?]", '/users/1/machines/1/trouble_tickets') </div><div> end </div><br class="webkit-block-placeholder"></div><div>for a form like so:</div><div><br class="webkit-block-placeholder">
</div><div><% form_for( :trouble_ticket, </div><div> :url => { :action => 'create', </div><div> :user_id => @machine.current_owner, </div><div> :machine_id => @machine } ) do |f| %>
</div><div>...</div><div><br class="webkit-block-placeholder"></div><div>Now this fails.</div><div><br class="webkit-block-placeholder"></div><div>The way it will pass is to change the url parameters to _explicitly_ call the id method on the
</div><div>parameter values like so:</div><div><br class="webkit-block-placeholder"></div><div><div><% form_for( :trouble_ticket,</div><div> :url => { :action => 'create',</div><div> <b>:user_id => @
machine.current_owner.id,</b></div><div> <b>:machine_id => @<a href="http://machine.id">machine.id</a></b> } ) do |f| %></div><div>...</div><div><br class="webkit-block-placeholder"></div><div>(nb. I am stubbing and mock these objects )
</div><div><br class="webkit-block-placeholder"></div><div>My thought is that rails does not require this since it helps by making sure the #id of each object is used in the action url.</div><div><br class="webkit-block-placeholder">
</div><div>Is this an error in rspec or just something (mildly inconsistent? ) which I'll have to do in this very limited context ?</div><div><br class="webkit-block-placeholder"></div><div>Cheers!</div><div>sinclair</div>
<div><br class="webkit-block-placeholder"></div></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div>