David Zhang
2011-Jul-05 23:34 UTC
Using Capybara to select from a collection_select call (select tag)
I''m trying to use Capybara to test this. I have a step that goes When I select "Price Chopper" from "Organization" And the step definition is When /^(?:|I )select "(.+)" from "(.+)"$/ do |value, field| select(value, :from => field) end For some reason, I keep getting the error: cannot select option, no select box with id, name, or label ''Organization'' found (Capybara::ElementNotFound) (eval):2:in `select'' … although my view is <label>Organization</label> <%= collection_select :restaurant, :organization_id, Organization.all, :id, :name, { :prompt => "[Select organization]" } %> Shouldn''t this work? The label is "Organization"! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/VS1C-NuAYbQJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Zhang
2011-Jul-10 02:06 UTC
Re: Using Capybara to select from a collection_select call (select tag)
I''m sure the solution to this is simple... anyone know? I just want to test the select field... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/S0CXEQGsUucJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
jrw
2011-Jul-12 09:19 UTC
Aw: Re: Using Capybara to select from a collection_select call (select tag)
The error message is "no select box ... with label ''Organization'' found". Your label exists, but it is not connected to the select field. It should be <label for="restaurant_organization_id"></label> If you''re using it in some kind of form_for(@restaurant) - helper you''d simply have to use form.label :organization_id. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/S_ioHCtfYfUJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.