Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created December 28, 2010 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jugyo/756962 to your computer and use it in GitHub Desktop.
Save jugyo/756962 to your computer and use it in GitHub Desktop.
email_steps_ja.rb
# encoding: utf-8
# from: http://ukstudio.jp/2009/05/11/cucumber_email_spec_for_action_mailer/
Given /^(?:すべてのメールをクリアする|メールボックスが空になっている)$/ do
reset_mailer
end
# Use this step to open the most recently sent e-mail.
When /^メールを開く$/ do
open_email(current_email_address)
end
When /^"([^']*?)"のメールを開く$/ do |address|
open_email(address)
end
When /^メール中の"(.*)"リンクを開く$/ do |link|
visit_in_email(link)
end
Then /^メールを(.+)通受信していること$/ do |amount|
amount = 1 if amount == "an"
unread_emails_for(current_email_address).size.should == amount.to_i
end
Then /^"([^']*?)"がメールを(\d+)通受信していること$/ do |address, n|
unread_emails_for(address).size.should == n.to_i
end
Then /^"([^']*?)"がメールを受信していないこと$/ do |address|
find_email(address).should be_nil
end
Then /^メールの件名が"(.*)"となっていること$/ do |text|
current_email.should have_subject(text)
end
Then /^メールの本文に"(.*)"が含まれていること$/ do |text|
current_email.body.should =~ Regexp.new(text)
end
Then /^メールの本文に"(.*)"が含まれていないこと$/ do |text|
current_email.body.should_not =~ Regexp.new(text)
end
When %r{^"([^']*?)"の件名が"([^']*?)"のメールを開く$} do |address, subject|
open_email(address, :with_subject => subject)
end
When %r{^"([^']*?)"の本文が"([^']*?)"のメールを開く$} do |address, text|
open_email(address, :with_text => text)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment