Sha256: 06f3586a9de96f974b77a05e8a29f08a4f493645ccc6620f153cb5c0dd755d1b

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'
class OrderMailerTest < ActionMailer::TestCase
  tests OrderMailer
  
  context "order mailer" do
    setup do
      @order = Factory.create(:order)
    end

    context "confirm email" do    
      setup do
        OrderMailer.deliver_confirm!(@order)
      end
      
      should "can be successfully sent" do
        assert_sent_email
      end
      
    end

    context "cancel email" do    
      setup do
        OrderMailer.deliver_cancel!(@order)
      end
      
      should "can be successfully sent" do
        assert_sent_email
      end
    end
    
    context "order_bcc and mail_bcc configurations" do
      setup do
        Spree::Config.set(:order_bcc => "tom@gmail.com, dick@gmail.com, harry@gmail.com") 
        Spree::Config.set(:mail_bcc => "tom@gmail.com, dick@gmail.com, alice@gmail.com")
        OrderMailer.deliver_confirm!(@order)
      end
      
      should "only send bcc mail to unique users" do
        assert_equal 4, ActionMailer::Base.deliveries.first.bcc.size
        assert_contains ActionMailer::Base.deliveries.first.bcc, "tom@gmail.com"
        assert_contains ActionMailer::Base.deliveries.first.bcc, "alice@gmail.com"
        assert_contains ActionMailer::Base.deliveries.first.bcc, "dick@gmail.com"
        assert_contains ActionMailer::Base.deliveries.first.bcc, "harry@gmail.com"
      end
    
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree-0.11.4 test/unit/order_mailer_test.rb
spree-0.11.3 test/unit/order_mailer_test.rb
spree-0.11.2 test/unit/order_mailer_test.rb
spree-0.11.1 test/unit/order_mailer_test.rb
spree-0.11.0 test/unit/order_mailer_test.rb
spree-0.10.2 test/unit/order_mailer_test.rb
spree-0.10.1 test/unit/order_mailer_test.rb
spree-0.10.0 test/unit/order_mailer_test.rb
spree-0.10.0.beta test/unit/order_mailer_test.rb