ruby on rails - Select field using Capybara -
there following generated html code:
<label for="place_type_id">type</label><br /> <select id="place_type_id" name="place[type_id]"><option value="1">restaurant</option> <option value="2">cafe</option> <option value="3">club</option></select>
i need select option rspec test:
select "club", from: "place[type_id]"
but doesn't work. how can fix it? i've tried use 'id' instead of 'name' in 'from' parameter, doesn't work too.
it looks select box can found name, id or label text example looks should work. capybara::node::actions:
find select box on page , select particular option it. if select box multiple select, select can called multiple times select more 1 option. select box can found via name, id or label text.
we're overlooking though. maybe square brackets throwing off capybara? see happens when selecting label text.
select 'club', from: 'type'
or id:
select 'club', from: :place_type_id
Comments
Post a Comment