On May 13, 2009, at 1:42 PM, Fernando Perez wrote:
Hi,
I use restful routes. In one of my views I have a form that looks
like:
<%- form_tag '/items/update', :method => :put do -%>
...
<%= submit_tag "Recalculate" %>
<%- end -%>
I know I cheated a bit, as I should be submitting to /items/1 instead.
Anyway, now how can I trigger the update action in my controller test?
I tried stuff like:
post :update, {:method => 'put', :item => {'1' => {:quantity => 5}}}
put :update, :item => 1 etc.
There are 4 methods for the 4 HTTP types. get, post, put, delete.
-----
BJ Clark
But the route recognition isn't pleased, I guess it's missing
an :id. Is
it possible to test the way I coded it?
PS: please no comment about writing code before testing, I know it's a
bad habit, and I am doing my best to change it.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users