diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-15 04:18:32 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-09-15 04:18:32 +0000 |
commit | d48039cefb684d678480e1f078c6082792038d03 (patch) | |
tree | e10145a291c4424e69e7e8e0ed4aeaacd067c4ec /actionpack/test | |
parent | c87206cc575031ae5d422a7729e32954e1184b26 (diff) | |
download | rails-d48039cefb684d678480e1f078c6082792038d03.tar.gz rails-d48039cefb684d678480e1f078c6082792038d03.tar.bz2 rails-d48039cefb684d678480e1f078c6082792038d03.zip |
Fixed that setting request.format would also affect respond_to blocks [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7479 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 40392abbe9..144aff7d7c 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -35,6 +35,15 @@ class RespondToController < ActionController::Base end end + def forced_xml + request.format = :xml + + respond_to do |type| + type.html { render :text => "HTML" } + type.xml { render :text => "XML" } + end + end + def just_xml respond_to do |type| type.xml { render :text => "XML" } @@ -343,6 +352,14 @@ class MimeControllerTest < Test::Unit::TestCase assert_equal "RSS", @response.body end + def test_internally_forced_format + get :forced_xml + assert_equal "XML", @response.body + + get :forced_xml, :format => "html" + assert_equal "XML", @response.body + end + def test_extension_synonyms get :html_xml_or_rss, :format => "xhtml" assert_equal "HTML", @response.body |