Sha256: 3e901fbcdfb0df2ee17ff31f87bb156c3c63ffe660070240f59ac6258ab97d2e

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

When /^I follow the link sent to "([^"]+)"$/ do |email_address|
  email = ActionMailer::Base.deliveries.detect do |tmail|
    tmail.to.include?(email_address)
  end or raise "No email sent to #{email_address}"

  unless match = email.body.match(%r{http://\S+})
    raise "No link included in the email:\n#{email.body}"
  end
  url = match[0]

  visit url
end

Then /^an email with subject "([^"]*)" should be sent to "([^"]*)"$/ do |subject, to_address|
  email = ActionMailer::Base.deliveries.detect do |tmail|
    tmail.subject.include?(subject)
  end or raise "No email with subject #{subject}"

  unless email.to.include?(to_address)
    raise "No email sent to #{to_address}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saucy-0.2.33 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.2.32 lib/generators/saucy/features/templates/step_definitions/email_steps.rb