Created
June 16, 2009 12:25
-
-
Save masuidrive/130659 to your computer and use it in GitHub Desktop.
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
# Cucumber email_steps.rb for Merb | |
Given /^clear mailbox$/ do | |
Merb::Mailer.deliveries.clear.should == [] | |
end | |
Then /^I should receive (an|\d+) emails?$/ do |amount| | |
amount = 1 if amount == "an" | |
Merb::Mailer.deliveries.size.should == amount | |
end | |
Then /^"(.*?)" should receive (an|\d+) emails?$/ do |email, amount| | |
amount = 1 if amount == "an" | |
Merb::Mailer.deliveries.select{|e| e.get_header("To").join==email}.size.should == amount | |
end | |
Then /^I should not receive emails$/ do | |
Merb::Mailer.deliveries.should be_empty | |
end | |
Then /^"(.*?)" should not receive emails?$/ do |email| | |
Merb::Mailer.deliveries.select{|e| e.get_header("To").join==email}.should be_empty | |
end | |
Then %r{^I should see "(.*?)" in the email$} do |text| | |
current_email.body.should =~ Regexp.new(text) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment