aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_layout_test.rb
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 17:31:18 +0100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 17:31:18 +0100
commitf30d73bab4c676b187276797ac2a6dc89132c43f (patch)
tree36cb0f1f3aaa3edf5b7daee48df69d22ae21ba34 /actionmailer/test/mail_layout_test.rb
parent7409b734841c8bd691006634dd072212aa905cf4 (diff)
downloadrails-f30d73bab4c676b187276797ac2a6dc89132c43f.tar.gz
rails-f30d73bab4c676b187276797ac2a6dc89132c43f.tar.bz2
rails-f30d73bab4c676b187276797ac2a6dc89132c43f.zip
Add new class delivery method API.
Diffstat (limited to 'actionmailer/test/mail_layout_test.rb')
-rw-r--r--actionmailer/test/mail_layout_test.rb42
1 files changed, 20 insertions, 22 deletions
diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb
index b4bd583616..4038fbf339 100644
--- a/actionmailer/test/mail_layout_test.rb
+++ b/actionmailer/test/mail_layout_test.rb
@@ -2,14 +2,14 @@ require 'abstract_unit'
class AutoLayoutMailer < ActionMailer::Base
- def hello(recipient)
- recipients recipient
+ def hello
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
end
- def spam(recipient)
- recipients recipient
+ def spam
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
@@ -17,8 +17,8 @@ class AutoLayoutMailer < ActionMailer::Base
render(:inline => "Hello, <%= @world %>", :layout => 'spam')
end
- def nolayout(recipient)
- recipients recipient
+ def nolayout
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
@@ -26,8 +26,8 @@ class AutoLayoutMailer < ActionMailer::Base
render(:inline => "Hello, <%= @world %>", :layout => false)
end
- def multipart(recipient, type = nil)
- recipients recipient
+ def multipart(type = nil)
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
@@ -38,14 +38,14 @@ end
class ExplicitLayoutMailer < ActionMailer::Base
layout 'spam', :except => [:logout]
- def signup(recipient)
- recipients recipient
+ def signup
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
end
- def logout(recipient)
- recipients recipient
+ def logout
+ recipients 'test@localhost'
subject "You have a mail"
from "tester@example.com"
end
@@ -56,8 +56,6 @@ class LayoutMailerTest < Test::Unit::TestCase
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
-
- @recipient = 'test@localhost'
end
def teardown
@@ -65,12 +63,12 @@ class LayoutMailerTest < Test::Unit::TestCase
end
def test_should_pickup_default_layout
- mail = AutoLayoutMailer.create_hello(@recipient)
+ mail = AutoLayoutMailer.hello
assert_equal "Hello from layout Inside", mail.body.to_s.strip
end
def test_should_pickup_multipart_layout
- mail = AutoLayoutMailer.create_multipart(@recipient)
+ mail = AutoLayoutMailer.multipart
# CHANGED: content_type returns an object
# assert_equal "multipart/alternative", mail.content_type
assert_equal "multipart/alternative", mail.mime_type
@@ -94,7 +92,7 @@ class LayoutMailerTest < Test::Unit::TestCase
end
def test_should_pickup_multipartmixed_layout
- mail = AutoLayoutMailer.create_multipart(@recipient, "multipart/mixed")
+ mail = AutoLayoutMailer.multipart("multipart/mixed")
# CHANGED: content_type returns an object
# assert_equal "multipart/mixed", mail.content_type
assert_equal "multipart/mixed", mail.mime_type
@@ -116,7 +114,7 @@ class LayoutMailerTest < Test::Unit::TestCase
end
def test_should_fix_multipart_layout
- mail = AutoLayoutMailer.create_multipart(@recipient, "text/plain")
+ mail = AutoLayoutMailer.multipart("text/plain")
assert_equal "multipart/alternative", mail.mime_type
assert_equal 2, mail.parts.size
@@ -129,22 +127,22 @@ class LayoutMailerTest < Test::Unit::TestCase
def test_should_pickup_layout_given_to_render
- mail = AutoLayoutMailer.create_spam(@recipient)
+ mail = AutoLayoutMailer.spam
assert_equal "Spammer layout Hello, Earth", mail.body.to_s.strip
end
def test_should_respect_layout_false
- mail = AutoLayoutMailer.create_nolayout(@recipient)
+ mail = AutoLayoutMailer.nolayout
assert_equal "Hello, Earth", mail.body.to_s.strip
end
def test_explicit_class_layout
- mail = ExplicitLayoutMailer.create_signup(@recipient)
+ mail = ExplicitLayoutMailer.signup
assert_equal "Spammer layout We do not spam", mail.body.to_s.strip
end
def test_explicit_layout_exceptions
- mail = ExplicitLayoutMailer.create_logout(@recipient)
+ mail = ExplicitLayoutMailer.logout
assert_equal "You logged out", mail.body.to_s.strip
end
end