Sha256: 772b5159f79e5ff42b6caabbb5e8f2bcf9f55b3c0fee36b5825f91f0e667d3e0

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

require 'test_helper'

class LayoutsTest < ActionMailer::TestCase

  def test_no_layout
    email = UserNoLayoutMailer.welcome.deliver_now
    assert !ActionMailer::Base.deliveries.empty?
    # Test the body of the sent email contains what we expect it to
    assert_equal ["foo@example.com"], email.to
    assert_equal "hello world",       email.subject

    body_contents = /<h2 id="welcome">Welcome!<\/h2>/
    assert_match body_contents,       email.html_part.body.to_s

    body_contents = /## Welcome!/
    assert_match body_contents,       email.text_part.body.to_s
  end

  def test_layout_renders_fine
    email = UserWithLayoutMailer.welcome.deliver_now
    assert !ActionMailer::Base.deliveries.empty?
    # Test the body of the sent email contains what we expect it to
    assert_equal ["foo@example.com"], email.to
    assert_equal "hello world",       email.subject

    body_contents = /HTML<h2 id="welcome">Welcome!<\/h2>/
    assert_match body_contents,       email.html_part.body.to_s

    body_contents = /TEXT## Welcome!/
    assert_match body_contents,       email.text_part.body.to_s
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
maildown-3.3.1 test/integration/layouts_test.rb
maildown-3.3.0 test/integration/layouts_test.rb
maildown-3.2.0 test/integration/layouts_test.rb
maildown-3.1.0 test/integration/layouts_test.rb
maildown-3.0.3 test/integration/layouts_test.rb
maildown-3.0.2 test/integration/layouts_test.rb
maildown-3.0.1 test/integration/layouts_test.rb
maildown-3.0.0 test/integration/layouts_test.rb