Sha256: 262abf293e968035398e609cd947e1b0ba3650715abb4ea6e9e5eb79198bb6fe

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

require 'test_helper'

module Maktoub
  class NewsletterMailerTest < ActionMailer::TestCase
    setup do
      @mailer = NewsletterMailer.publish('test_template', email: 'zaid@example.com', name: 'zaid')

    end
    test "should have the right subject recipient and sender" do
      assert_equal "Test Template", @mailer.subject
      assert_equal ['maktoub@example.com'], @mailer.from # defined in dummy/config/initializers/maktoub.rb
      assert_equal ['zaid@example.com'], @mailer.to
    end

    test "should be multipart" do
      assert_equal true, @mailer.multipart?
      assert_equal false, @mailer.html_part.blank?
      assert_equal false, @mailer.text_part.blank?
    end

    test "html_part" do
      body = @mailer.html_part.body.to_s

      assert_match /View it in your browser/, body # change to link assertion
      assert_match /Copyright/, body
      assert_match /All rights reserved/, body
      assert_match /update subscription preferences/, body # change to link assertion
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maktoub-0.1.0 test/functional/maktoub/newsletter_mailer_test.rb
maktoub-0.0.1 test/functional/maktoub/newsletter_mailer_test.rb