From da290fae09086f864e59ba43b4a0c4f3d8661da1 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Sun, 11 May 2014 15:41:23 -0700 Subject: Remove unnecessary include for integration tests. --- actionpack/test/abstract_unit.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 03a4741f42..98419efc89 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -251,7 +251,6 @@ end module ActionController class Base - include ActionController::Testing # This stub emulates the Railtie including the URL helpers from a Rails application include SharedTestRoutes.url_helpers include SharedTestRoutes.mounted_helpers -- cgit v1.2.3 From 781f8a8a3308938df6b1a6fd6073dcec7f988ec8 Mon Sep 17 00:00:00 2001 From: Zuhao Wan Date: Wed, 28 May 2014 22:14:57 +0800 Subject: Clear inflections after test. --- actionpack/test/controller/params_wrapper_test.rb | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb index 11ccb6cf3b..645ecae220 100644 --- a/actionpack/test/controller/params_wrapper_test.rb +++ b/actionpack/test/controller/params_wrapper_test.rb @@ -337,14 +337,26 @@ class IrregularInflectionParamsWrapperTest < ActionController::TestCase tests ParamswrappernewsController def test_uses_model_attribute_names_with_irregular_inflection - ActiveSupport::Inflector.inflections do |inflect| - inflect.irregular 'paramswrappernews_item', 'paramswrappernews' - end + with_dup do + ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular 'paramswrappernews_item', 'paramswrappernews' + end - with_default_wrapper_options do - @request.env['CONTENT_TYPE'] = 'application/json' - post :parse, { 'username' => 'sikachu', 'test_attr' => 'test_value' } - assert_parameters({ 'username' => 'sikachu', 'test_attr' => 'test_value', 'paramswrappernews_item' => { 'test_attr' => 'test_value' }}) + with_default_wrapper_options do + @request.env['CONTENT_TYPE'] = 'application/json' + post :parse, { 'username' => 'sikachu', 'test_attr' => 'test_value' } + assert_parameters({ 'username' => 'sikachu', 'test_attr' => 'test_value', 'paramswrappernews_item' => { 'test_attr' => 'test_value' }}) + end end end + + private + + def with_dup + original = ActiveSupport::Inflector::Inflections.instance_variable_get(:@__instance__)[:en] + ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original.dup) + yield + ensure + ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original) + end end -- cgit v1.2.3 From b1bc553385524373cab759a64e0bb650afda6d98 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 28 May 2014 20:06:08 -0700 Subject: Remove TODO. --- actionpack/test/journey/router_test.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index 1a2106a3c5..f298808be8 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -4,18 +4,10 @@ require 'abstract_unit' module ActionDispatch module Journey class TestRouter < ActiveSupport::TestCase - # TODO : clean up routing tests so we don't need this hack - class StubDispatcher < Routing::RouteSet::Dispatcher - def initialize - super({}) - end - def dispatcher?; true; end - end - attr_reader :routes def setup - @app = StubDispatcher.new + @app = Routing::RouteSet::Dispatcher.new({}) @routes = Routes.new @router = Router.new(@routes) @formatter = Formatter.new(@routes) @@ -566,8 +558,6 @@ module ActionDispatch end end - RailsEnv = Struct.new(:env) - def rails_env env, klass = ActionDispatch::Request klass.new env end -- cgit v1.2.3