File: inline_on_delivery_spec.rb

package info (click to toggle)
ruby-roadie-rails 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: ruby: 1,670; sh: 47; makefile: 4
file content (40 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (3)
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