spec/mail_ses_spec.rb in mail-ses-0.1.0 vs spec/mail_ses_spec.rb in mail-ses-0.1.1
- old
+ new
@@ -63,20 +63,20 @@
mail.add_file __FILE__
expect { ses.deliver!(mail) }.to raise_error(ArgumentError, 'Attachment provided without message body')
end
context 'when options set' do
- before { allow_any_instance_of(Mail::Message).to receive(:to_s).and_return('Fixed message body') }
+ before { allow(mail).to receive(:to_s).and_return('Fixed message body') }
let(:ses_options) { { stub_responses: true, mail_options: { source: 'foo@bar.com', source_arn: 'sa1' } } }
let(:exp) do
{
source: 'foo@bar.com',
source_arn: 'sa2',
destinations: %w[to1@def.com to2@xyz.com cc1@xyz.com cc2@def.com bcc1@abc.com bcc2@def.com],
raw_message: {
- data: "Rml4ZWQgbWVzc2FnZSBib2R5\n"
+ data: 'Fixed message body'
}
}
end
it 'allows pass-thru and override of default options' do
@@ -115,19 +115,19 @@
end
describe '::build_raw_email_options' do
let(:options) { {} }
subject { described_class.build_raw_email_options(mail, options) }
- before { allow_any_instance_of(Mail::Message).to receive(:to_s).and_return('Fixed message body') }
+ before { allow(mail).to receive(:to_s).and_return('Fixed message body') }
context 'without options' do
let(:exp) do
{
source: 'from@abc.com',
destinations: %w[to1@def.com to2@xyz.com cc1@xyz.com cc2@def.com bcc1@abc.com bcc2@def.com],
raw_message: {
- data: "Rml4ZWQgbWVzc2FnZSBib2R5\n"
+ data: 'Fixed message body'
}
}
end
it { expect(subject).to eq(exp) }
@@ -154,10 +154,10 @@
{ name: 'Name', value: 'Value' }
],
configuration_set_name: 'configuration_set_name',
destinations: %w[to1@def.com to2@xyz.com cc1@xyz.com cc2@def.com bcc1@abc.com bcc2@def.com],
raw_message: {
- data: "Rml4ZWQgbWVzc2FnZSBib2R5\n"
+ data: 'Fixed message body'
}
}
end
it { expect(subject).to eq(exp) }