Skip to content
This repository

adding regression test in master for #8631 #8963

Merged
merged 1 commit into from over 1 year ago

3 participants

Aditya Sanghi Carlos Antonio da Silva Andrew White
Aditya Sanghi

As per comment by @pixeltrix on #8631 porting the regression test to master.

Tests that local inflections should not interfere with HTTP_METHOD_LOOKUP

Andrew White pixeltrix merged commit c8b0a6f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 16, 2013
Aditya Sanghi asanghi adding regression test in master for #8631 3c19064
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. +21 0 actionpack/test/dispatch/request_test.rb
21 actionpack/test/dispatch/request_test.rb
@@ -462,6 +462,27 @@ def url_for(options = {})
462 462 assert request.put?
463 463 end
464 464
  465 + test "post uneffected by local inflections" do
  466 + existing_acrnoyms = ActiveSupport::Inflector.inflections.acronyms.dup
  467 + existing_acrnoym_regex = ActiveSupport::Inflector.inflections.acronym_regex.dup
  468 + begin
  469 + ActiveSupport::Inflector.inflections do |inflect|
  470 + inflect.acronym "POS"
  471 + end
  472 + assert_equal "pos_t", "POST".underscore
  473 + request = stub_request "REQUEST_METHOD" => "POST"
  474 + assert_equal :post, ActionDispatch::Request::HTTP_METHOD_LOOKUP["POST"]
  475 + assert_equal :post, request.method_symbol
  476 + assert request.post?
  477 + ensure
  478 + # Reset original acronym set
  479 + ActiveSupport::Inflector.inflections do |inflect|
  480 + inflect.send(:instance_variable_set,"@acronyms",existing_acrnoyms)
  481 + inflect.send(:instance_variable_set,"@acronym_regex",existing_acrnoym_regex)
  482 + end
  483 + end
  484 + end
  485 +
465 486 test "xml format" do
466 487 request = stub_request
467 488 request.expects(:parameters).at_least_once.returns({ :format => 'xml' })

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.