Sha256: 741a2ffeedd1d8bd795a3adb29c7e0058a7232845e65f872e6d9648012373848

Contents?: true

Size: 939 Bytes

Versions: 11

Compression:

Stored size: 939 Bytes

Contents

require 'test_helper'

module Rooler
  class DeliveryMailerTest < ActionMailer::TestCase
        
    setup do 
      Rooler::Rule.class_eval { liquid_methods :name }
    end
    
    test "deliver" do
      template = create(:template, 
                  to: "{{rule.name}}@to.com", 
                  cc: "{{rule.name}}@cc.com", 
                  subject: "subject is: {{rule.name}}", 
                  body: "body is: {{rule.name}}"
                  )
      rule = create(:rule, name: 'test_name', template: template)
      
      delivery = create(:delivery, rule: rule, deliverable: rule)
      email = DeliveryMailer.send_mail(delivery).deliver

      assert !ActionMailer::Base.deliveries.empty?
      assert_equal ['test_name@to.com'], email.to
      assert_equal ['test_name@cc.com'], email.cc
      assert_equal 'subject is: test_name', email.subject
      assert_equal 'body is: test_name', email.body.to_s
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rooler-0.0.11 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.10 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.9 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.8 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.7 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.6 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.5 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.4 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.3 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.2 test/mailers/rooler/delivery_mailer_test.rb
rooler-0.0.1 test/mailers/rooler/delivery_mailer_test.rb