Je suis confronté au problème suivant, c'est la première fois que j'utilise capybara, avez-vous une idée de la façon dont je peux résoudre ce problème, merci.
J'utilise rails 3.0.0 et les gems suivants
gem 'rails', '3.0.0'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'rspec-rails'
gem 'spork'
gem 'launchy'
Mon scénario est le suivant
When I go to the new customer page
And I fill in "Email" with "john@example.com"
Dans mon fichier customer_steps.rb, j'ai
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |arg1, arg2|
fill_in arg1, :with => arg2
end
À mon avis
- form_for @customer do |f|
= f.label :email, 'Email'
= f.text_field :email
= f.submit
Lorsque j'exécute mon scénario, j'obtiens le message d'erreur suivant
Scenario: Register new customer # features/manage_customers.feature:7
When I go to the new customer page # features/step_definitions/customer_steps.rb:1
And I fill in "Email" with "john@example.com" # features/step_definitions/customer_steps.rb:5
cannot fill in, no text field, text area or password field with id, name, or label 'Email' found (Capybara::ElementNotFound)
./features/step_definitions/customer_steps.rb:6:in `/^I fill in "([^"]*)" with "([^"]*)"$/'
features/manage_customers.feature:9:in `And I fill in "Email" with "john@example.com"'