runeleaf
6/5/2009 - 8:00 AM

email_ja_steps.rb

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|
  text_ = NKF.nkf("I", 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