aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-29 10:56:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-29 10:56:33 -0700
commit295e91221123b912f2545cdc2e5623aeb53b220f (patch)
treea41a2591753ceb1c3bb2c242a3461d7fc9a5c75a /actionpack/test
parent8ed1a562c6293c81c894f3fe55fe88610c4f6caa (diff)
parent4584be9b8bd15277cc05e8729830247df45d46dc (diff)
downloadrails-295e91221123b912f2545cdc2e5623aeb53b220f.tar.gz
rails-295e91221123b912f2545cdc2e5623aeb53b220f.tar.bz2
rails-295e91221123b912f2545cdc2e5623aeb53b220f.zip
Merge branch 'master' into mapper
* master: Update url to rake docs [ci skip] Name#model_name doesn't return a String object Result sets never override a model's column type [ci skip] Make last note show up in postgresql guide. Add missing `:param` option from the docs for Mapper#match [ci skip] Option discovered by @zackperdue in #14741, implemented in #5581. Add @senny's changed from #14741, including code font for `resources` options, and wrapped to 80 chars. [ci skip] Use github url for homepage of log4r [ci skip] Remove TODO. Ensure we always use instances of the adapter specific column class Fix indentation from 1b4b26f [ci skip] [ci skip] Improve form_helpers.md guide. Clear inflections after test. Remove unnecessary include for integration tests. Added documentation for the :param option for resourceful routing
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract_unit.rb1
-rw-r--r--actionpack/test/controller/params_wrapper_test.rb26
-rw-r--r--actionpack/test/journey/router_test.rb12
3 files changed, 20 insertions, 19 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 46de36317e..6584d20840 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
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
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