Created
June 30, 2009 15:59
-
-
Save jamesarosen/138228 to your computer and use it in GitHub Desktop.
Instructions for using Test::Unit or Shoulda with Cucumber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require 'cucumber/rails/rspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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