From 36c6aa01ee0a7aee5b0510a8e649c44de318b060 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 9 Sep 2008 17:20:55 -0500 Subject: Revert "Add layout functionality to mailers." This reverts commit e9a8e0053be3b293ab89fb584f1d660063f107aa. --- .../fixtures/auto_layout_mailer/hello.html.erb | 1 - .../explicit_layout_mailer/logout.html.erb | 1 - .../explicit_layout_mailer/signup.html.erb | 1 - .../fixtures/layouts/auto_layout_mailer.html.erb | 1 - actionmailer/test/fixtures/layouts/spam.html.erb | 1 - actionmailer/test/mail_layout_test.rb | 78 ---------------------- 6 files changed, 83 deletions(-) delete mode 100644 actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb delete mode 100644 actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb delete mode 100644 actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb delete mode 100644 actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb delete mode 100644 actionmailer/test/fixtures/layouts/spam.html.erb delete mode 100644 actionmailer/test/mail_layout_test.rb (limited to 'actionmailer/test') diff --git a/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb b/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb deleted file mode 100644 index 54950788f7..0000000000 --- a/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb +++ /dev/null @@ -1 +0,0 @@ -Inside \ No newline at end of file diff --git a/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb b/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb deleted file mode 100644 index 0533a3b2fe..0000000000 --- a/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb +++ /dev/null @@ -1 +0,0 @@ -You logged out \ No newline at end of file diff --git a/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb b/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb deleted file mode 100644 index 4789e888c6..0000000000 --- a/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb +++ /dev/null @@ -1 +0,0 @@ -We do not spam \ No newline at end of file diff --git a/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb b/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb deleted file mode 100644 index 932271450c..0000000000 --- a/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb +++ /dev/null @@ -1 +0,0 @@ -Hello from layout <%= yield %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/layouts/spam.html.erb b/actionmailer/test/fixtures/layouts/spam.html.erb deleted file mode 100644 index 619d6b16b4..0000000000 --- a/actionmailer/test/fixtures/layouts/spam.html.erb +++ /dev/null @@ -1 +0,0 @@ -Spammer layout <%= yield %> \ No newline at end of file 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 -- cgit v1.2.3 From 6228220c9b8a3bb32f8617ad2d963dabc965376e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 9 Sep 2008 17:25:09 -0500 Subject: Revert "Revert "Add layout functionality to mailers."" This reverts commit 36c6aa01ee0a7aee5b0510a8e649c44de318b060. --- .../fixtures/auto_layout_mailer/hello.html.erb | 1 + .../explicit_layout_mailer/logout.html.erb | 1 + .../explicit_layout_mailer/signup.html.erb | 1 + .../fixtures/layouts/auto_layout_mailer.html.erb | 1 + actionmailer/test/fixtures/layouts/spam.html.erb | 1 + actionmailer/test/mail_layout_test.rb | 78 ++++++++++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb create mode 100644 actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb create mode 100644 actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb create mode 100644 actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb create mode 100644 actionmailer/test/fixtures/layouts/spam.html.erb create mode 100644 actionmailer/test/mail_layout_test.rb (limited to 'actionmailer/test') diff --git a/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb b/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb new file mode 100644 index 0000000000..54950788f7 --- /dev/null +++ b/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb @@ -0,0 +1 @@ +Inside \ No newline at end of file diff --git a/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb b/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb new file mode 100644 index 0000000000..0533a3b2fe --- /dev/null +++ b/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb @@ -0,0 +1 @@ +You logged out \ No newline at end of file diff --git a/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb b/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb new file mode 100644 index 0000000000..4789e888c6 --- /dev/null +++ b/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb @@ -0,0 +1 @@ +We do not spam \ No newline at end of file diff --git a/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb b/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb new file mode 100644 index 0000000000..932271450c --- /dev/null +++ b/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb @@ -0,0 +1 @@ +Hello from layout <%= yield %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/layouts/spam.html.erb b/actionmailer/test/fixtures/layouts/spam.html.erb new file mode 100644 index 0000000000..619d6b16b4 --- /dev/null +++ b/actionmailer/test/fixtures/layouts/spam.html.erb @@ -0,0 +1 @@ +Spammer layout <%= yield %> \ No newline at end of file diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb new file mode 100644 index 0000000000..ffba9a16bd --- /dev/null +++ b/actionmailer/test/mail_layout_test.rb @@ -0,0 +1,78 @@ +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 -- cgit v1.2.3 From f3f7d166d8e7a1a2e15371f2870115406e1aaac2 Mon Sep 17 00:00:00 2001 From: "U-ESCAPEE\\Mack" Date: Thu, 4 Sep 2008 12:03:29 -0400 Subject: Fixed problem causes by leftover backup templates ending in tilde [state:committed #969] Signed-off-by: David Heinemeier Hansson --- .../test_mailer/implicitly_multipart_example.text.html.erb~ | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ (limited to 'actionmailer/test') diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ new file mode 100644 index 0000000000..946d99ede5 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ @@ -0,0 +1,10 @@ + + + HTML formatted message to <%= @recipient %>. + + + + + HTML formatted message to <%= @recipient %>. + + -- cgit v1.2.3