Sha256: f48899febdf5ceb8cdf3a4379a59c1681dd8426b7cfec757d60d9282bf81609a

Contents?: true

Size: 1.21 KB

Versions: 86

Compression:

Stored size: 1.21 KB

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

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

  email = to_address.detect do |tmail|
    tmail.subject.include?(subject)
  end or raise "No email sent to #{email_address} with subject #{subject}"

  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

86 entries across 86 versions & 2 rubygems

Version Path
saucy-0.16.1 features/step_definitions/engine/email_steps.rb
saucy-0.16.0 features/step_definitions/engine/email_steps.rb
saucy-0.15.2 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.15.1 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.15.0 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.14.5 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.14.3 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.10.10 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.14.2 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.14.1 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.14.0 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.13.3 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.13.2 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.10.9 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.10.8 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.13.1 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.13.0 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.12.5 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.12.4 lib/generators/saucy/features/templates/step_definitions/email_steps.rb
saucy-0.12.3 lib/generators/saucy/features/templates/step_definitions/email_steps.rb