diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-16 03:04:14 -0800 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-16 03:04:14 -0800 |
commit | d3dcb4b9b26c1ea8b44ee8660af10683cd41e35f (patch) | |
tree | 6ea875a7d2f0be3b46d08a4121818e1d5196918f /actionpack/test/dispatch/request_test.rb | |
parent | fd990f24df87c0a445ea6a2a2df6fa8fbd3556b1 (diff) | |
parent | 5f3b40e824cce3f6dcdfac63fa47bcd80d67dd5a (diff) | |
download | rails-d3dcb4b9b26c1ea8b44ee8660af10683cd41e35f.tar.gz rails-d3dcb4b9b26c1ea8b44ee8660af10683cd41e35f.tar.bz2 rails-d3dcb4b9b26c1ea8b44ee8660af10683cd41e35f.zip |
Merge pull request #8632 from asanghi/3-2-stable
Fixes #8631 request post? detection should remain unaffected by local inflections such as POS for Point Of Sale
Diffstat (limited to 'actionpack/test/dispatch/request_test.rb')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 56431b4daf..dfd3ddbfa6 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -371,6 +371,27 @@ class RequestTest < ActiveSupport::TestCase assert request.put? end + test "post uneffected by local inflections" do + existing_acrnoyms = ActiveSupport::Inflector.inflections.acronyms.dup + existing_acrnoym_regex = ActiveSupport::Inflector.inflections.acronym_regex.dup + begin + ActiveSupport::Inflector.inflections do |inflect| + inflect.acronym "POS" + end + assert_equal "pos_t", "POST".underscore + request = stub_request "REQUEST_METHOD" => "POST" + assert_equal :post, ActionDispatch::Request::HTTP_METHOD_LOOKUP["POST"] + assert_equal :post, request.method_symbol + assert request.post? + ensure + # Reset original acronym set + ActiveSupport::Inflector.inflections do |inflect| + inflect.send(:instance_variable_set,"@acronyms",existing_acrnoyms) + inflect.send(:instance_variable_set,"@acronym_regex",existing_acrnoym_regex) + end + end + end + test "xml format" do request = stub_request request.expects(:parameters).at_least_once.returns({ :format => 'xml' }) |