The following formtastic form checkbox field set:
<%= semantic_form_for @store do |f| %>
<%= f.inputs do %>
<%= f.input :services, :as => :check_boxes, :collection => Service.all %>
<% end -%>
<% end -%>
is sending bad params for :services on a Cucumber test using Capybara, making the test fail, while the actual app sends the correct ones, which gets processed fine:
#cucumber steps using the boiler_plate capybara web_steps.rb:
Given a "Mail Order" service
...(steps for rest of the form)...
When I check "Mail Order"
And I press "Create Store"
Then I should see "Store was successfully created."
And I should see "Mail Order"
#params sent by cucumber
"store"=>{"services"=>["[\"4d8247ed7f5bfd2275000004\"]"]
#params sent by app on manual test
"store"=>{"services"=>["4d8247ed7f5bfd2275000004"]}
Though the html form itself is rendered the same way in both cases:
<input id="store_services_4d8247ed7f5bfd2275000004" name="store[services][]" type="checkbox" value="4d8247ed7f5bfd2275000004" />
Seems like somewhere during the request params-building, the form key/value pairs for that field get parsed differently when submitted by Cucumber/Capybara.
Anyone else come across this?