Sha256: 8808ac62ff6d18ea71b13a3b2491e8a030ec1de421aab6dda1101ef30478121f

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
require 'mailstro/test_strategy'

describe Mailstro::TestStrategy do
  before do
    Mailstro::TestStrategy.enable
  end

  describe '.enable' do
    it "doesn't send anything when enabled" do
      Mailstro::Delivery.should_not_receive(:deliver)

      Mailstro.deliver(:welcome,
        :to => 'a@a.com'
      )
    end
  end

  describe '.has_delivered?' do
    context "with a delivery" do
      before do
        Mailstro.deliver(:welcome,
          :to => 'a@a.com'
        )
      end

      it 'matches template name' do
        Mailstro.should have_delivered(:welcome)
      end

      it 'matches contact email and template name' do
        Mailstro.should have_delivered(:welcome,
          :to => 'a@a.com'
        )
      end

      it 'does not match an invalid template name' do
        Mailstro.should_not have_delivered(:build_failed)
      end

      it 'does not match an invalid contact email' do
        Mailstro.should_not have_delivered(:welcome,
          :to => 'b@a.com'
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailstro-0.1.0 spec/mailstro/test_strategy_spec.rb
mailstro-0.0.10 spec/mailstro/test_strategy_spec.rb