[rspec-users] form action url example
sinclair bain
rspec.user at gmail.com
Fri Sep 28 11:37:46 EDT 2007
Hi,
I have the following example:
it 'should have a form with an action attribute' do
response.should have_tag( "form[action=?]",
'/users/1/machines/1/trouble_tickets')
end
for a form like so:
<% form_for( :trouble_ticket,
:url => { :action => 'create',
:user_id => @machine.current_owner,
:machine_id => @machine } ) do |f| %>
...
Now this fails.
The way it will pass is to change the url parameters to _explicitly_ call
the id method on the
parameter values like so:
<% form_for( :trouble_ticket,
:url => { :action => 'create',
*:user_id => @machine.current_owner.id,*
*:machine_id => @machine.id* } ) do |f| %>
...
(nb. I am stubbing and mock these objects )
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.
Is this an error in rspec or just something (mildly inconsistent? ) which
I'll have to do in this very limited context ?
Cheers!
sinclair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070928/d5a685cf/attachment.html
More information about the rspec-users
mailing list