From f9cd92f4ee49c689f25dbe7da008fb298a5feb4f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 31 May 2006 18:52:24 +0000 Subject: Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/mime_responds_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index e696a41cb5..c3763bc566 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -254,4 +254,18 @@ class MimeControllerTest < Test::Unit::TestCase xhr :get, :using_defaults assert_equal '$("body").visualEffect("highlight");', @response.body end + + def test_forced_format + get :html_xml_or_rss + assert_equal "HTML", @response.body + + get :html_xml_or_rss, :format => "html" + assert_equal "HTML", @response.body + + get :html_xml_or_rss, :format => "xml" + assert_equal "XML", @response.body + + get :html_xml_or_rss, :format => "rss" + assert_equal "RSS", @response.body + end end -- cgit v1.2.3