Sha256: d907ea1e608ad4e1b64064bbff4752d26d111dcf900d3995eb7d1711429f338a

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe MailyHerald::Mailer do
  before(:each) do
    @entity = FactoryGirl.create :user
    @mailing = MailyHerald.dispatch(:ad_hoc_mail)
    @list = @mailing.list
  end

  context "without subscription" do
    it "should not deliver" do
      expect(MailyHerald::Log.delivered.count).to eq(0)

      AdHocMailer.ad_hoc_mail(@entity).deliver

      expect(MailyHerald::Log.delivered.count).to eq(0)
    end
  end

  context "with subscription" do
    before(:each) do
      @list.subscribe! @entity
    end

    it "should deliver" do
      expect(MailyHerald::Log.delivered.count).to eq(0)

      AdHocMailer.ad_hoc_mail(@entity).deliver

      expect(MailyHerald::Log.delivered.count).to eq(1)
    end
  end

  context "without defined mailing" do
    it "should not deliver" do
      expect do
        expect(MailyHerald::Log.delivered.count).to eq(0)

        AdHocMailer.missing_mailing_mail(@entity).deliver

        expect(MailyHerald::Log.delivered.count).to eq(0)
      end.not_to change { ActionMailer::Base.deliveries.count }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maily_herald-0.9.4 spec/mailers/maily_herald/mailer_spec.rb
maily_herald-0.9.3 spec/mailers/maily_herald/mailer_spec.rb
maily_herald-0.9.2 spec/mailers/maily_herald/mailer_spec.rb
maily_herald-0.9.1 spec/mailers/maily_herald/mailer_spec.rb