Sha256: ecd3e0fcfb83a48ad13ee9d7cad8435a5e9e2374fb3aa18bddccd84f2485eae7

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"
require 'mail'

module GhostInThePost
  describe Mailer do
    let(:email) { Mail.new(to: "foo@example.com", from: "me@example.com") }
    let(:instance) { AutoMailer.new(email) }

    describe "#include_script" do

      it "should add to include scripts" do
        instance.include_script "test.js"
        expect(instance.included_scripts).to eq(["test.js"])
      end
    end

    describe "#mail" do
      it "should return an email" do
        expect(instance.mail).to be_kind_of(Mail::Message)
      end

      it "should return an email extended with GhostOnCommand and GhostOnDelivery" do
        expect(email).to receive(:extend).with(GhostOnCommand).and_call_original
        expect(email).to receive(:extend).with(GhostOnDelivery).and_call_original
        mail = instance.mail
        expect(mail).to be_kind_of(GhostOnCommand)
        expect(mail).to be_kind_of(GhostOnDelivery)
      end

      it "should have set the emails included scripts" do
        email.extend GhostOnCommand
        expect(email).to receive(:included_scripts=).with(nil).and_call_original
        instance.mail
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ghost_in_the_post-0.0.2 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.1 spec/lib/ghost_in_the_post/mailer_spec.rb