Я работаю над приложением Rails 3 с Cucumber 1.1.1 и пытаюсь выбрать несколько флажков в моих сценариях огурца.
Вот мои несколько флажков в haml:
- for diocese in Diocese.all
= check_box_tag "clergy[diocese_ids][]", diocese.id, @clergy.dioceses.include?(diocese)
= f.label diocese.name
%br
Вот мой шаг огурца
When /^I check the (\d+)(st|nd|rd|th) of the "([^"]*)" checkboxes$/ do |index, junk, group|
page.all("input[id=\"clergy_diocese_ids_\"]")[index.to_i - 1].check('clergy_diocese_ids_')
end
Вот мой тест огурца:
@wip
Scenario: New Clergy
Given I am on the clergies page
When I follow "New Clergy"
And I fill in "Surname" with "Wells"
And I fill in "Given names" with "Robin"
And I check the 1st of the "diocese" checkboxes
And I check the 2nd of the "diocese" checkboxes
And I press "Create Clergy"
Then I should see "Clergy was successfully created."
Ошибка, которую я получаю при выполнении теста:
And I check the 1st of the "diocese" checkboxes # fea
tures/step_definitions/clergy_steps.rb:37
cannot check field, no checkbox with id, name, or label 'clergy_diocese_ids_' found (C
apybara::ElementNotFound)
./features/step_definitions/clergy_steps.rb:38:in `/^I check the (\d+)(st|nd|rd|th) of
the "([^"]*)" checkboxes$/'
features/clergy_new.feature:17:in `And I check the 1st of the "diocese" checkboxes'
Я пытался поиграть с селектором page.all, но не могу разобраться.