Skip to content

Commit

Permalink
Merge pull request #5935 from luisramos0/fix_build
Browse files Browse the repository at this point in the history
Fix master build - fix mail interceptor spec
  • Loading branch information
Matt-Yorkley committed Aug 20, 2020
2 parents d6160b5 + 0abcbc7 commit 9d772db
Showing 1 changed file with 8 additions and 6 deletions.
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

0 comments on commit 9d772db

Please sign in to comment.