Sha256: 03833fe72aaab2fe480907b378da58f20521ad48b79a68db2238de0882707670

Contents?: true

Size: 1.5 KB

Versions: 16

Compression:

Stored size: 1.5 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) { SomeMailer.new(email) }
    describe "#include_script" do
      it "should add to include scripts" do
        instance.include_script "test.js"
        expect(instance.instance_variable_get(:@included_scripts)).to eq(["test.js"])
        instance.include_script "foo.js"
        expect(instance.instance_variable_get(:@included_scripts)).to eq(["test.js", "foo.js"])
      end
    end
    describe "#set_ghost_timeout" do
      it "should set the timeout" do
        instance.set_ghost_timeout 42
        expect(instance.instance_variable_get(:@ghost_timeout)).to eq(42)
      end
    end
    describe "#set_ghost_wait_event" do
      it "should set the wait_event" do
        instance.set_ghost_wait_event "doo:doo"
        expect(instance.instance_variable_get(:@ghost_wait_event)).to eq("doo:doo")
      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(instance.mail).to be_kind_of(GhostOnCommand)
      end
      it "should have set the emails variables" do
        expect(email).to receive(:included_scripts=)
        expect(email).to receive(:ghost_timeout=)
        expect(email).to receive(:ghost_wait_event=)
        instance.mail
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ghost_in_the_post-0.1.4 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.1.3 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.1.2 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.1.0 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.14 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.13 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.12 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.11 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.10 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.9 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.8 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.7 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.6 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.5 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.4 spec/lib/ghost_in_the_post/mailer_spec.rb
ghost_in_the_post-0.0.3 spec/lib/ghost_in_the_post/mailer_spec.rb