0
votes

I'm running feature test in my rails app with Rspec and capybara. I'm filling out a form, which includes the following code:

<%= f.collection_select(:model_id, Model.all, :id, :name) %>

This code works COMPLETELY fine when I actually go to the view, and it shows all of the expected name.

I'm trying to fill it out in my Rspec feature test like so:

select('Option', :from 'model[model_attributes][model_id]')

However, capybara always gives me the error

Capybara::ElementNotFound:
Unale to find option 'option'

When capybara gives me a screenshot and I go to the screenshot, the select element from that form just appears as a blank form (all the other ones besides the collection_select appear fine). Since it doesn't appear in the screenshot, does that mean Capybara simply doesn't support the collection_select at the moment?

Thank you in advance.

1

1 Answers

0
votes

UPDATE: Solved my own question.

I simply had to initialize objects with FactoryGirl before visiting the page and submitting the form. That way, the collection select had something to look for.