aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJorge Bejar <jorge@wyeworks.com>2015-12-29 11:39:58 -0300
committerJorge Bejar <jorge@wyeworks.com>2015-12-29 13:42:57 -0300
commit9a85da9367eaf65b4232a548ff1f2535ef3496cd (patch)
tree10c33c53560c9f5a6734ff669218278d1b384c51 /actionpack/test
parent929c61573e289e432a4e571ae157248745ae2eae (diff)
downloadrails-9a85da9367eaf65b4232a548ff1f2535ef3496cd.tar.gz
rails-9a85da9367eaf65b4232a548ff1f2535ef3496cd.tar.bz2
rails-9a85da9367eaf65b4232a548ff1f2535ef3496cd.zip
Rely on default Mime format when MimeNegotiation#format_from_path_extension is not a valid type
Closes #22747
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/request_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 7dd9d05e62..26386d2aa1 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -897,6 +897,18 @@ class RequestFormat < BaseRequestTest
ActionDispatch::Request.ignore_accept_header = old_ignore_accept_header
end
end
+
+ test "format taken from the path extension" do
+ request = stub_request 'PATH_INFO' => '/foo.xml'
+ assert_called(request, :parameters, times: 1, returns: {}) do
+ assert_equal [Mime[:xml]], request.formats
+ end
+
+ request = stub_request 'PATH_INFO' => '/foo.123'
+ assert_called(request, :parameters, times: 1, returns: {}) do
+ assert_equal [Mime[:html]], request.formats
+ end
+ end
end
class RequestMimeType < BaseRequestTest