This project is archived and is in readonly mode.
fix snowman test helper to include _method only on non-GET or non-POST
Reported by Aditya Sanghi | October 3rd, 2010 @ 08:36 PM
Writing a test for a search_field related bug recently (5730), turned out to be slightly harder than usual since the expected resulted included a _method = 'get' within the snowman method.
I've included a patch to ensure that the _method only outputs for non-GET or non-POST queries. (i thought perhaps it better to check non-GET and non-POST rather than PUT or DELETE since in the future perhaps we might support other verbs (RESTfulie?) in the snowman.
I've also modified my test to actually work as a "method" get, since it was a search form.
Basically this patch fixes the test helpers to ensure "whole_form" and "snowman" can be used correctly in tests.
Comments and changes to this ticket
-
Aditya Sanghi October 3rd, 2010 @ 08:38 PM
- no changes were found...
-
Aditya Sanghi October 3rd, 2010 @ 08:40 PM
- Title changed from fix snowman test helper to include _method only on put or delete to fix snowman test helper to include _method only on non-GET or non-POST
-
Aditya Sanghi October 3rd, 2010 @ 09:23 PM
- Title changed from fix snowman test helper to include _method only on non-GET or non-POST to [PATCH] fix snowman test helper to include _method only on non-GET or non-POST
-
Aditya Sanghi October 4th, 2010 @ 02:32 PM
- Assigned user set to José Valim
- Tag changed from tests actionpack, 3.x, actionview to tests actionpack, 3.x, actionview, patch
To be clearer, when writing tests, using whole_form and snowman helpers methods led to incorrect expected text. Those helpers do not handle "get" method forms very well which is what this patch fixes.
{mkd-extraction-27744e020310fe464731a5d317065098}
<%= form_for(@post, :url => search_posts_path, :html => {:method => :get}) do |f| %><% end %>
was resulting in the snowman function putting a hidden parameter for "_method" with value = "get" which is wrong. The form_text was also hard-coded to always put the method in the form as "post".
-
José Valim October 7th, 2010 @ 08:29 AM
- Importance changed from to Low
It seems it does not. However be patient as I am a bit busy right now. I will apply it this or next week when I give another pass in LH applying tickets.
-
Jeff Kreeftmeijer October 11th, 2010 @ 08:16 PM
- Title changed from [PATCH] fix snowman test helper to include _method only on non-GET or non-POST to fix snowman test helper to include _method only on non-GET or non-POST
Using the "patch" tag instead of prefixing the ticket title with "[PATCH]" to make sure patched tickets end up in the open patches bin. :)
-
Repository October 11th, 2010 @ 11:56 PM
- State changed from new to resolved
(from [582a088ba7f3e720a259f6e01b3fabcda87484b7]) Fix test helpers to ensure get method forms are properly tested [#5753 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/582a088ba7f3e720a259f6e01b3fab...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5753 fix snowman test helper to include _method only on non-GET or non-POST (from [582a088ba7f3e720a259f6e01b3fabcda87484b7]) Fix tes...