Skip to content

Instantly share code, notes, and snippets.

@masuidrive
Created June 16, 2009 12:25
Show Gist options
  • Save masuidrive/130659 to your computer and use it in GitHub Desktop.
Save masuidrive/130659 to your computer and use it in GitHub Desktop.
# 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