Skip to content

Instantly share code, notes, and snippets.

@tomafro
Created October 15, 2009 09:36
Show Gist options
  • Save tomafro/210852 to your computer and use it in GitHub Desktop.
Save tomafro/210852 to your computer and use it in GitHub Desktop.
From:
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
field_labeled(label).should be_checked
end
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
field_labeled(label).should_not be_checked
end
To something like this:
Then /^the "([^\"]*)" checkbox should( not)? be checked$/ do |label, invert|
field_labeled(label).should_unless(invert).match be_checked
end
Or this:
Then /^the "([^\"]*)" checkbox should( not)? be checked$/ do |label, invert|
swap_shoulds_and_should_nots if invert
field_labeled(label).should be_checked
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment