Permalink
Browse files

Fix silent failure of rxml templates. Closes #9879.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7921 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ea1eafb commit cf2ee1451baca9c1c1ec00f221ce5a2fbefaa41f @jeremy jeremy committed Oct 15, 2007
Showing with 18 additions and 1 deletion.
  1. +5 −0 actionmailer/CHANGELOG
  2. +11 −0 actionmailer/test/mail_render_test.rb
  3. +2 −1 actionpack/lib/action_view/base.rb
@@ -1,3 +1,8 @@
+*SVN*
+
+* Fix silent failure of rxml templates. #9879 [jstewart]
+
+
*2.0.0 [Preview Release]* (September 29th, 2007)
* Fix attachment decoding when using the TMail C extension. #7861 [orangechicken]
@@ -15,6 +15,12 @@ def file_template(recipient)
body render(:file => "signed_up", :body => { :recipient => recipient })
end
+ def rxml_template(recipient)
+ recipients recipient
+ subject "rendering rxml template"
+ from "tester@example.com"
+ end
+
def initialize_defaults(method_name)
super
mailer_name "test_mailer"
@@ -55,6 +61,11 @@ def test_file_template
mail = RenderMailer.create_file_template(@recipient)
assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip
end
+
+ def test_rxml_template
+ mail = RenderMailer.deliver_rxml_template(@recipient)
+ assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip
+ end
end
class FirstSecondHelperTest < Test::Unit::TestCase
@@ -572,7 +572,8 @@ def create_template_source(extension, template, render_symbol, locals)
if template_requires_setup?(extension)
body = case extension.to_sym
when :rxml, :builder
- "controller.response.content_type ||= Mime::XML\n" +
+ content_type_handler = (controller.respond_to?(:response) ? "controller.response" : "controller")
+ "#{content_type_handler}.content_type ||= Mime::XML\n" +
"xml = Builder::XmlMarkup.new(:indent => 2)\n" +
template +
"\nxml.target!\n"

0 comments on commit cf2ee14

Please sign in to comment.