Skip to content

Instantly share code, notes, and snippets.

@jamesarosen
Created June 30, 2009 15:59
Show Gist options
  • Save jamesarosen/138228 to your computer and use it in GitHub Desktop.
Save jamesarosen/138228 to your computer and use it in GitHub Desktop.
Instructions for using Test::Unit or Shoulda with Cucumber
# config.gem "rspec", :lib => false, :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
# config.gem "rspec-rails", :lib => 'spec/rails', :version => ">=1.2.6" unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
# require 'cucumber/rails/rspec'
Then /^I should see "([^\"]*)"$/ do |text|
# response.should contain(text)
assert_match /#{text}/m, @response.body
end
Then /^I should not see "([^\"]*)"$/ do |text|
# response.should_not contain(text)
assert_no_match /#{text}/m, @response.body
end
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
# field_labeled(field).value.should =~ /#{value}/
assert_match /#{value}/, field_labeled(field).value
end
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
# field_labeled(field).value.should_not =~ /#{value}/
assert_no_match /#{value}/, field_labeled(field).value
end
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
# field_labeled(label).should be_checked
assert field_labeled(label).checked?
end
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
# field_labeled(label).should_not be_checked
assert !field_labeled(label).checked?
end
Then /^I should be on (.+)$/ do |page_name|
# URI.parse(current_url).path.should == path_to(page_name)
assert_equal path_to(page_name), URI.parse(current_url).path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment