Sha256: e3eeef8532182b9874551e50a362f8ab1d77ec88542966ec7c44b4b7e82a1f7d

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 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(
        :to            => 'a@a.com',
        :template_name => :welcome
      )
    end
  end

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

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

      it 'matches contact email and template name' do
        Mailstro.should have_delivered(
          :to            => 'a@a.com',
          :template_name => :welcome,
        )
      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(
          :to            => 'b@a.com',
          :template_name => :welcome,
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailstro-0.0.9 spec/mailstro/test_strategy_spec.rb