1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

adding regression test in master for #8631

This commit is contained in:
Aditya Sanghi 2013-01-16 16:59:45 +05:30
parent 94384bdbd6
commit 3c19064610

View file

@ -462,6 +462,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' })