Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Forked from tomafro/gist:210852
Created October 15, 2009 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisroos/210853 to your computer and use it in GitHub Desktop.
Save chrisroos/210853 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