Sha256: 20370788ac44f192cb9f31cd0cb7afc71726080cdf9bf163a64497408e5a5903

Contents?: true

Size: 991 Bytes

Versions: 9

Compression:

Stored size: 991 Bytes

Contents

When(/^contact "(.*?)" uses the unsubscribe link$/) do |name|
  first_name, last_name = name.split(/\s+/,2)
  contact = MailManager::Contact.where(first_name: first_name, last_name: last_name).first 
  path = URI.parse(contact.messages.first.unsubscribe_url).path
  visit path
end

Then(/^contact "(.*?)" should receive an email saying he unsubscribed$/) do |name|
  first_name, last_name = name.split(/\s+/,2)
  contact = MailManager::Contact.where(first_name: first_name, last_name: last_name).first 
  expect(ActionMailer::Base.deliveries.last.subject).to match /unsubscribe/i
  ActionMailer::Base.deliveries.last.parts.map(&:body).each do |body|
    expect(body).to match /Bob Dole/
  end
end

When(/^I use the test email's unsubscribe link$/) do
  unsubscribe_url = MailManager::TestMessage.last.unsubscribe_url
  path = URI.parse(unsubscribe_url).path
  visit path
end

When(/^I try to unsubscribe with an invalid guid$/) do
  visit MailManager.unsubscribe_path + '/boboisaclown'
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mail_manager-3.2.25.1 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.22.0 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.7 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.6 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.5 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.4 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.2 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.1 spec/test_app/features/step_definitions/subscription_steps.rb
mail_manager-3.2.0 spec/test_app/features/step_definitions/subscription_steps.rb