1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
# frozen_string_literal: true
require "spec_helper"
require "mail"
module Roadie
module Rails
describe InlineOnDelivery do
it "inlines on #delivery" do
inliner = instance_double(MailInliner, execute: nil)
options = instance_double(Options)
mail = FakeMail.new
allow(MailInliner).to receive(:new).and_return(inliner)
mail.extend(InlineOnDelivery)
mail.roadie_options = options
expect { mail.deliver }.to change(mail, :delivered?).to(true)
expect(MailInliner).to have_received(:new).with(mail, options)
expect(inliner).to have_received(:execute)
end
it "inlines on #delivery!" do
inliner = instance_double(MailInliner, execute: nil)
options = instance_double(Options)
mail = FakeMail.new
allow(MailInliner).to receive(:new).and_return(inliner)
mail.extend(InlineOnDelivery)
mail.roadie_options = options
expect { mail.deliver! }.to change(mail, :delivered?).to(true)
expect(MailInliner).to have_received(:new).with(mail, options)
expect(inliner).to have_received(:execute)
end
end
end
end
|