Skip to content

Instantly share code, notes, and snippets.

View sgulics's full-sized avatar

Steve Gulics sgulics

  • New Jersey, USA
View GitHub Profile
@sgulics
sgulics / jquery_validate_steps.rb
Created June 30, 2011 18:13
Cucumber Step definitions for testing a form that uses jquery's validator plugin
# goes in features/step_definitions
Then /^I should see the "([^"]*)" error for "([^"]*)"$/ do |error, label|
field = find_field(label)
html_label = find("label[for=#{field[:id]}][class=error]")
html_label.text.should eql(error)
end
Then /^I should not see errors for "([^"]*)"$/ do |label|
field = find_field(label)
lambda {find("label[for=#{field[:id]}][class=error]")}.should raise_error(Capybara::ElementNotFound)