aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_layout_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-09-09 17:20:55 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-09-09 17:20:55 -0500
commit36c6aa01ee0a7aee5b0510a8e649c44de318b060 (patch)
tree6988605e522b146dad945f308b20ea412e3842bb /actionmailer/test/mail_layout_test.rb
parent1398db0128be7ae01700712eafc95be5de430f7c (diff)
downloadrails-36c6aa01ee0a7aee5b0510a8e649c44de318b060.tar.gz
rails-36c6aa01ee0a7aee5b0510a8e649c44de318b060.tar.bz2
rails-36c6aa01ee0a7aee5b0510a8e649c44de318b060.zip
Revert "Add layout functionality to mailers."
This reverts commit e9a8e0053be3b293ab89fb584f1d660063f107aa.
Diffstat (limited to 'actionmailer/test/mail_layout_test.rb')
-rw-r--r--actionmailer/test/mail_layout_test.rb78
1 files changed, 0 insertions, 78 deletions
diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb
deleted file mode 100644
index ffba9a16bd..0000000000
--- a/actionmailer/test/mail_layout_test.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-require 'abstract_unit'
-
-class AutoLayoutMailer < ActionMailer::Base
- def hello(recipient)
- recipients recipient
- subject "You have a mail"
- from "tester@example.com"
- end
-
- def spam(recipient)
- recipients recipient
- subject "You have a mail"
- from "tester@example.com"
- body render(:inline => "Hello, <%= @world %>", :layout => 'spam', :body => { :world => "Earth" })
- end
-
- def nolayout(recipient)
- recipients recipient
- subject "You have a mail"
- from "tester@example.com"
- body render(:inline => "Hello, <%= @world %>", :layout => false, :body => { :world => "Earth" })
- end
-end
-
-class ExplicitLayoutMailer < ActionMailer::Base
- layout 'spam', :except => [:logout]
-
- def signup(recipient)
- recipients recipient
- subject "You have a mail"
- from "tester@example.com"
- end
-
- def logout(recipient)
- recipients recipient
- subject "You have a mail"
- from "tester@example.com"
- end
-end
-
-class LayoutMailerTest < Test::Unit::TestCase
- def setup
- set_delivery_method :test
- ActionMailer::Base.perform_deliveries = true
- ActionMailer::Base.deliveries = []
-
- @recipient = 'test@localhost'
- end
-
- def teardown
- restore_delivery_method
- end
-
- def test_should_pickup_default_layout
- mail = AutoLayoutMailer.create_hello(@recipient)
- assert_equal "Hello from layout Inside", mail.body.strip
- end
-
- def test_should_pickup_layout_given_to_render
- mail = AutoLayoutMailer.create_spam(@recipient)
- assert_equal "Spammer layout Hello, Earth", mail.body.strip
- end
-
- def test_should_respect_layout_false
- mail = AutoLayoutMailer.create_nolayout(@recipient)
- assert_equal "Hello, Earth", mail.body.strip
- end
-
- def test_explicit_class_layout
- mail = ExplicitLayoutMailer.create_signup(@recipient)
- assert_equal "Spammer layout We do not spam", mail.body.strip
- end
-
- def test_explicit_layout_exceptions
- mail = ExplicitLayoutMailer.create_logout(@recipient)
- assert_equal "You logged out", mail.body.strip
- end
-end