class LayoutMailerTest

Public Instance Methods

test_explicit_class_layout() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 88
def test_explicit_class_layout
  mail = ExplicitLayoutMailer.signup
  assert_equal "Spammer layout We do not spam", mail.body.to_s.strip
end
test_explicit_layout_exceptions() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 93
def test_explicit_layout_exceptions
  mail = ExplicitLayoutMailer.logout
  assert_equal "You logged out", mail.body.to_s.strip
end
test_should_pickup_default_layout() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 49
def test_should_pickup_default_layout
  mail = AutoLayoutMailer.hello
  assert_equal "Hello from layout Inside", mail.body.to_s.strip
end
test_should_pickup_layout_given_to_render() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 78
def test_should_pickup_layout_given_to_render
  mail = AutoLayoutMailer.spam
  assert_equal "Spammer layout Hello, Earth", mail.body.to_s.strip
end
test_should_pickup_multipart_layout() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 54
def test_should_pickup_multipart_layout
  mail = AutoLayoutMailer.multipart
  assert_equal "multipart/alternative", mail.mime_type
  assert_equal 2, mail.parts.size

  assert_equal "text/plain", mail.parts.first.mime_type
  assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.to_s

  assert_equal "text/html", mail.parts.last.mime_type
  assert_equal "Hello from layout text/html multipart", mail.parts.last.body.to_s
end
test_should_pickup_multipartmixed_layout() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 66
def test_should_pickup_multipartmixed_layout
  mail = AutoLayoutMailer.multipart("multipart/mixed")
  assert_equal "multipart/mixed", mail.mime_type
  assert_equal 2, mail.parts.size

  assert_equal "text/plain", mail.parts.first.mime_type
  assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.to_s

  assert_equal "text/html", mail.parts.last.mime_type
  assert_equal "Hello from layout text/html multipart", mail.parts.last.body.to_s
end
test_should_respect_layout_false() click to toggle source
# File actionmailer/test/mail_layout_test.rb, line 83
def test_should_respect_layout_false
  mail = AutoLayoutMailer.nolayout
  assert_equal "Hello, Earth", mail.body.to_s.strip
end