diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/request_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 65e88b74d8..db81eb3097 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -303,6 +303,18 @@ class RequestTest < Test::Unit::TestCase assert @request.head? end + def test_format + @request.instance_eval { @parameters = { :format => 'xml' } } + assert_equal Mime::XML, @request.format + + @request.instance_eval { @parameters = { :format => 'xhtml' } } + assert_equal Mime::HTML, @request.format + + @request.instance_eval { @parameters = { :format => nil } } + @request.env["HTTP_ACCEPT"] = "text/javascript" + assert_equal Mime::JS, @request.format + end + protected def set_request_method_to(method) @request.env['REQUEST_METHOD'] = method.to_s.upcase |