debian-mirror-gitlab/spec/lib/additional_email_headers_interceptor_spec.rb

30 lines
849 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe AdditionalEmailHeadersInterceptor do
2018-03-17 18:26:18 +05:30
let(:mail) do
ActionMailer::Base.mail(to: 'test@mail.com', from: 'info@mail.com', body: 'hello')
end
before do
mail.deliver_now
end
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
it 'adds Auto-Submitted header' do
2017-08-17 22:00:37 +05:30
expect(mail.header['To'].value).to eq('test@mail.com')
expect(mail.header['From'].value).to eq('info@mail.com')
expect(mail.header['Auto-Submitted'].value).to eq('auto-generated')
expect(mail.header['X-Auto-Response-Suppress'].value).to eq('All')
end
2018-03-17 18:26:18 +05:30
context 'when the same mail object is sent twice' do
before do
mail.deliver_now
end
it 'does not add the Auto-Submitted header twice' do
expect(mail.header['Auto-Submitted'].value).to eq('auto-generated')
expect(mail.header['X-Auto-Response-Suppress'].value).to eq('All')
end
end
2017-08-17 22:00:37 +05:30
end