Test that a form field has an error with Cucumber and Capybara

Updated . Posted . Visible to the public.

You can use the step definition below to say this:

Then the "Last name" field should have an error

Capybara

Then /^the "([^\"]*)" field should( not)? have an error$/ do |field, negate|
  expectation = negate ? :should_not : :should
  page.send(expectation, have_css('.field_with_errors', :text => field))
end
Henning Koch
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2011-09-29 20:35)