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