FIX: don't overwrite custom email headers when using mandrill/sparkpost

This commit is contained in:
Régis Hanol
2016-10-30 11:38:55 +01:00
parent 6aacc655d1
commit f8caae0be7
2 changed files with 30 additions and 2 deletions

View File

@ -139,6 +139,26 @@ describe Email::Sender do
Then { expect(message.header['X-Discourse-Reply-Key']).not_to be_present }
end
context "merges custom mandrill header" do
before do
ActionMailer::Base.smtp_settings[:address] = "smtp.mandrillapp.com"
message.header['X-MC-Metadata'] = { foo: "bar" }.to_json
end
When { email_sender.send }
Then { expect(message.header['X-MC-Metadata'].to_s).to match(message.message_id) }
end
context "merges custom sparkpost header" do
before do
ActionMailer::Base.smtp_settings[:address] = "smtp.sparkpostmail.com"
message.header['X-MSYS-API'] = { foo: "bar" }.to_json
end
When { email_sender.send }
Then { expect(message.header['X-MSYS-API'].to_s).to match(message.message_id) }
end
context 'email logs' do
let(:email_log) { EmailLog.last }