The checkbox is selected in the form field of the format form:
<%= semantic_form_for @store do |f| %> <%= f.inputs do %> <%= f.input :services, :as => :check_boxes, :collection => Service.all %> <% end -%> <% end -%>
sends bad parameters for: services on the Cucumber test using Capybara, which makes the check unsuccessful, while the actual application sends the correct messages, which are processed normally:
#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"]}
Although the html form itself is displayed the same in both cases:
<input id="store_services_4d8247ed7f5bfd2275000004" name="store[services][]" type="checkbox" value="4d8247ed7f5bfd2275000004" />
It seems that somewhere during the creation of params of the request, the key / value pair pairs for this field are handled differently if they are represented by Cucumber / Capybara.
Anyone else run into this?
ruby-on-rails cucumber capybara formtastic
oliverbarnes
source share