Sha256: 79d45194a8933165b0233dd1841622f27b217c91c915c824ab3e942626eeebef

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

# this file generated by script/generate pickle email
#
# add email mappings in features/support/email.rb

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true

Before do
  ActionMailer::Base.deliveries.clear
end

# Clear the deliveries array, useful if your background sends email that you want to ignore
Given(/^all emails? (?:have|has) been delivered$/) do
  ActionMailer::Base.deliveries.clear
end

Given(/^(\d)+ emails? should be delivered$/) do |count|
  expect(emails.size).to eq(count.to_i)
end

When(/^(?:I|they) follow "([^"]*?)" in #{capture_email}$/) do |link, email_ref|
  visit_in_email(email(email_ref), link)
end

When(/^(?:I|they) click the first link in #{capture_email}$/) do |email_ref|
  click_first_link_in_email(email(email_ref))
end

Then(/^(\d)+ emails? should be delivered to (.*)$/) do |count, to|
  expect(emails("to: \"#{email_for(to)}\"").size).to eq(count.to_i)
end

Then(/^(\d)+ emails? should be delivered with #{capture_fields}$/) do |count, fields|
  expect(emails(fields).size).to eq(count.to_i)
end

Then(/^#{capture_email} should be delivered to (.+)$/) do |email_ref, to|
  expect(email(email_ref, "to: \"#{email_for(to)}\"")).not_to be_nil
end

Then(/^#{capture_email} should not be delivered to (.+)$/) do |email_ref, to|
  expect(email(email_ref, "to: \"#{email_for(to)}\"")).to be_nil
end

Then(/^#{capture_email} should have #{capture_fields}$/) do |email_ref, fields|
  expect(email(email_ref, fields)).not_to be_nil
end

Then(/^#{capture_email} should contain "(.*)"$/) do |email_ref, text|
  expect(email(email_ref).body).to match(/#{text}/)
end

Then(/^#{capture_email} should not contain "(.*)"$/) do |email_ref, text|
  expect(email(email_ref).body).not_to match(/#{text}/)
end

Then(/^#{capture_email} should link to (.+)$/) do |email_ref, page|
  expect(email(email_ref).body).to match(/#{path_to(page)}/)
end

Then(/^show me the emails?$/) do
   save_and_open_emails
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
pickle-0.5.0 features/step_definitions/email_steps.rb
pickle-0.5.0 rails_generators/pickle/templates/email_steps.rb