Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix master build - fix mail interceptor spec #5935

Merged
merged 1 commit into from
Aug 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions spec/lib/spree/core/mail_interceptor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

require 'spec_helper'

# We'll use the OrderMailer as a quick and easy way to test. IF it works here
# it works for all email (in theory.)
# Here we use the OrderMailer as a way to test the mail interceptor.
describe Spree::OrderMailer do
let(:order) { Spree::Order.new(email: "customer@example.com") }
let(:message) { Spree::OrderMailer.confirm_email(order) }
let(:order) do
Spree::Order.new(distributor: create(:enterprise),
bill_address: create(:address))
end
let(:message) { Spree::OrderMailer.confirm_email_for_shop(order) }

before(:all) do
ActionMailer::Base.perform_deliveries = true
Expand Down Expand Up @@ -64,7 +66,7 @@
Spree::Config[:intercept_email] = "intercept@foobar.com"
message.deliver
@email = ActionMailer::Base.deliveries.first
expect(@email.subject.match(/customer@example\.com/)).to be_truthy
expect(@email.subject).to include order.distributor.contact.email
end
end

Expand All @@ -73,7 +75,7 @@
Spree::Config[:intercept_email] = ""
message.deliver
@email = ActionMailer::Base.deliveries.first
expect(@email.to).to eq ["customer@example.com"]
expect(@email.to).to eq [order.distributor.contact.email]
end
end
end
Expand Down