From 0a132c2fe13fb2b8d5dade9cf6abd70601376287 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 22 Apr 2009 17:16:28 -0700 Subject: Refactor ActionView::Path * Decouple from ActionController and ActionMailer * Bring back localization support. * Prepare to decouple templates from the filesystem. * Prepare to decouple localization from ActionView * Fix ActionMailer to take advantage of ActionView::Path --- .../test/fixtures/auto_layout_mailer/multipart.html.erb | 1 + .../test/fixtures/auto_layout_mailer/multipart.text.erb | 1 + .../fixtures/auto_layout_mailer/multipart.text.html.erb | 1 - .../fixtures/auto_layout_mailer/multipart.text.plain.erb | 1 - .../test/fixtures/test_mailer/_subtemplate.text.erb | 1 + .../test/fixtures/test_mailer/_subtemplate.text.plain.erb | 1 - .../test_mailer/custom_templating_extension.html.haml | 6 ++++++ .../test_mailer/custom_templating_extension.text.haml | 6 ++++++ .../test_mailer/custom_templating_extension.text.html.haml | 6 ------ .../custom_templating_extension.text.plain.haml | 6 ------ .../test_mailer/implicitly_multipart_example.html.erb | 10 ++++++++++ .../test_mailer/implicitly_multipart_example.html.erb~ | 10 ++++++++++ .../test_mailer/implicitly_multipart_example.text.erb | 2 ++ .../test_mailer/implicitly_multipart_example.text.html.erb | 10 ---------- .../implicitly_multipart_example.text.html.erb~ | 10 ---------- .../implicitly_multipart_example.text.plain.erb | 2 -- .../test_mailer/implicitly_multipart_example.text.yaml.erb | 1 - .../test_mailer/implicitly_multipart_example.yaml.erb | 1 + .../fixtures/test_mailer/included_subtemplate.text.erb | 1 + .../test_mailer/included_subtemplate.text.plain.erb | 1 - .../test/fixtures/test_mailer/rxml_template.builder | 2 -- actionmailer/test/mail_service_test.rb | 14 +++++++------- 22 files changed, 46 insertions(+), 48 deletions(-) create mode 100644 actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb create mode 100644 actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb delete mode 100644 actionmailer/test/fixtures/auto_layout_mailer/multipart.text.html.erb delete mode 100644 actionmailer/test/fixtures/auto_layout_mailer/multipart.text.plain.erb create mode 100644 actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb create mode 100644 actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml create mode 100644 actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml delete mode 100644 actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml delete mode 100644 actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml create mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb create mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ create mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ delete mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb create mode 100644 actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb create mode 100644 actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb delete mode 100644 actionmailer/test/fixtures/test_mailer/rxml_template.builder (limited to 'actionmailer/test') diff --git a/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb b/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb new file mode 100644 index 0000000000..6d73f199c4 --- /dev/null +++ b/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb @@ -0,0 +1 @@ +text/html multipart \ No newline at end of file diff --git a/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb b/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb new file mode 100644 index 0000000000..f4b91e4031 --- /dev/null +++ b/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb @@ -0,0 +1 @@ +text/plain multipart \ No newline at end of file diff --git a/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.html.erb b/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.html.erb deleted file mode 100644 index 6d73f199c4..0000000000 --- a/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.html.erb +++ /dev/null @@ -1 +0,0 @@ -text/html multipart \ No newline at end of file diff --git a/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.plain.erb b/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.plain.erb deleted file mode 100644 index f4b91e4031..0000000000 --- a/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +++ /dev/null @@ -1 +0,0 @@ -text/plain multipart \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb b/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb new file mode 100644 index 0000000000..3b4ba35f20 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb @@ -0,0 +1 @@ +let's go! \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb b/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb deleted file mode 100644 index 3b4ba35f20..0000000000 --- a/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb +++ /dev/null @@ -1 +0,0 @@ -let's go! \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml new file mode 100644 index 0000000000..847d065c37 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml @@ -0,0 +1,6 @@ +%p Hello there, + +%p + Mr. + = @recipient + from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml new file mode 100644 index 0000000000..847d065c37 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml @@ -0,0 +1,6 @@ +%p Hello there, + +%p + Mr. + = @recipient + from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml deleted file mode 100644 index 847d065c37..0000000000 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p Hello there, - -%p - Mr. - = @recipient - from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml b/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml deleted file mode 100644 index 847d065c37..0000000000 --- a/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p Hello there, - -%p - Mr. - = @recipient - from haml \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb new file mode 100644 index 0000000000..946d99ede5 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb @@ -0,0 +1,10 @@ + + + HTML formatted message to <%= @recipient %>. + + + + + HTML formatted message to <%= @recipient %>. + + diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ new file mode 100644 index 0000000000..946d99ede5 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ @@ -0,0 +1,10 @@ + + + HTML formatted message to <%= @recipient %>. + + + + + HTML formatted message to <%= @recipient %>. + + diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb new file mode 100644 index 0000000000..a6c8d54cf9 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb @@ -0,0 +1,2 @@ +Plain text to <%= @recipient %>. +Plain text to <%= @recipient %>. 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 deleted file mode 100644 index 946d99ede5..0000000000 --- a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - - - HTML formatted message to <%= @recipient %>. - - - - - HTML formatted message to <%= @recipient %>. - - 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~ deleted file mode 100644 index 946d99ede5..0000000000 --- a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +++ /dev/null @@ -1,10 +0,0 @@ - - - HTML formatted message to <%= @recipient %>. - - - - - HTML formatted message to <%= @recipient %>. - - diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb deleted file mode 100644 index a6c8d54cf9..0000000000 --- a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +++ /dev/null @@ -1,2 +0,0 @@ -Plain text to <%= @recipient %>. -Plain text to <%= @recipient %>. diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb deleted file mode 100644 index c14348c770..0000000000 --- a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +++ /dev/null @@ -1 +0,0 @@ -yaml to: <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb new file mode 100644 index 0000000000..c14348c770 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb @@ -0,0 +1 @@ +yaml to: <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb b/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb new file mode 100644 index 0000000000..a93c30ea1a --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb @@ -0,0 +1 @@ +Hey Ho, <%= render :partial => "subtemplate" %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb b/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb deleted file mode 100644 index a93c30ea1a..0000000000 --- a/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +++ /dev/null @@ -1 +0,0 @@ -Hey Ho, <%= render :partial => "subtemplate" %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/rxml_template.builder b/actionmailer/test/fixtures/test_mailer/rxml_template.builder deleted file mode 100644 index d566bd8d7c..0000000000 --- a/actionmailer/test/fixtures/test_mailer/rxml_template.builder +++ /dev/null @@ -1,2 +0,0 @@ -xml.instruct! -xml.test \ No newline at end of file diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index b7d5fd5dd3..b27bda49be 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -338,6 +338,7 @@ class ActionMailerTest < Test::Unit::TestCase def test_nested_parts_with_body created = nil + TestMailer.create_nested_multipart_with_body(@recipient) assert_nothing_raised { created = TestMailer.create_nested_multipart_with_body(@recipient)} assert_equal 1,created.parts.size assert_equal 2,created.parts.first.parts.size @@ -351,8 +352,8 @@ class ActionMailerTest < Test::Unit::TestCase def test_attachment_with_custom_header created = nil - assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)} - assert_equal "", created.parts[1].header['content-id'].to_s + assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient) } + assert created.parts.any? { |p| p.header['content-id'].to_s == "" } end def test_signed_up @@ -824,7 +825,7 @@ EOF assert_equal 3, mail.parts.length assert_equal "1.0", mail.mime_version assert_equal "multipart/alternative", mail.content_type - assert_equal "text/yaml", mail.parts[0].content_type + assert_equal "application/x-yaml", mail.parts[0].content_type assert_equal "utf-8", mail.parts[0].sub_header("content-type", "charset") assert_equal "text/plain", mail.parts[1].content_type assert_equal "utf-8", mail.parts[1].sub_header("content-type", "charset") @@ -835,11 +836,11 @@ EOF def test_implicitly_multipart_messages_with_custom_order assert ActionView::Template.template_handler_extensions.include?("bak"), "bak extension was not registered" - mail = TestMailer.create_implicitly_multipart_example(@recipient, nil, ["text/yaml", "text/plain"]) + mail = TestMailer.create_implicitly_multipart_example(@recipient, nil, ["application/x-yaml", "text/plain"]) assert_equal 3, mail.parts.length assert_equal "text/html", mail.parts[0].content_type assert_equal "text/plain", mail.parts[1].content_type - assert_equal "text/yaml", mail.parts[2].content_type + assert_equal "application/x-yaml", mail.parts[2].content_type end def test_implicitly_multipart_messages_with_charset @@ -938,8 +939,7 @@ EOF def test_multipart_with_template_path_with_dots mail = FunkyPathMailer.create_multipart_with_template_path_with_dots(@recipient) assert_equal 2, mail.parts.length - assert_equal 'text/plain', mail.parts[0].content_type - assert_equal 'utf-8', mail.parts[0].charset + assert mail.parts.any? {|part| part.content_type == "text/plain" && part.charset == "utf-8"} end def test_custom_content_type_attributes -- cgit v1.2.3