From 45b1045d16126e69ad5af395fa14d1291914a4d4 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 20 Jun 2012 21:20:12 +0200 Subject: raise an error if no implicit mailer template could be found --- actionmailer/test/base_test.rb | 7 +++++++ .../test/fixtures/base_mailer/attachment_with_hash.html.erb | 0 .../base_mailer/attachment_with_hash_default_encoding.html.erb | 0 .../test/fixtures/base_mailer/welcome_with_headers.html.erb | 0 .../test/fixtures/base_test/after_filter_mailer/welcome.html.erb | 0 .../test/fixtures/base_test/before_filter_mailer/welcome.html.erb | 0 .../base_test/default_inline_attachment_mailer/welcome.html.erb | 0 .../fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb | 0 actionmailer/test/fixtures/proc_mailer/welcome.html.erb | 0 9 files changed, 7 insertions(+) create mode 100644 actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb create mode 100644 actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb create mode 100644 actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb create mode 100644 actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb create mode 100644 actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb create mode 100644 actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb create mode 100644 actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb create mode 100644 actionmailer/test/fixtures/proc_mailer/welcome.html.erb (limited to 'actionmailer/test') diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 1d747ed18a..1b2e39b3f7 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -433,6 +433,13 @@ class BaseTest < ActiveSupport::TestCase assert_equal("TEXT Implicit Multipart", mail.text_part.body.decoded) end + test "should raise if missing template in implicit render" do + assert_raises ActionView::MissingTemplate do + BaseMailer.implicit_different_template('missing_template').deliver + end + assert_equal(0, BaseMailer.deliveries.length) + end + test "you can specify a different template for explicit render" do mail = BaseMailer.explicit_different_template('explicit_multipart_templates').deliver assert_equal("HTML Explicit Multipart Templates", mail.html_part.body.decoded) diff --git a/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb b/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb b/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb b/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb b/actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb b/actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb b/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb b/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/actionmailer/test/fixtures/proc_mailer/welcome.html.erb b/actionmailer/test/fixtures/proc_mailer/welcome.html.erb new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3