mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Clear inflections after test.
This commit is contained in:
parent
0f80a52629
commit
781f8a8a33
1 changed files with 19 additions and 7 deletions
|
@ -337,14 +337,26 @@ class IrregularInflectionParamsWrapperTest < ActionController::TestCase
|
||||||
tests ParamswrappernewsController
|
tests ParamswrappernewsController
|
||||||
|
|
||||||
def test_uses_model_attribute_names_with_irregular_inflection
|
def test_uses_model_attribute_names_with_irregular_inflection
|
||||||
ActiveSupport::Inflector.inflections do |inflect|
|
with_dup do
|
||||||
inflect.irregular 'paramswrappernews_item', 'paramswrappernews'
|
ActiveSupport::Inflector.inflections do |inflect|
|
||||||
end
|
inflect.irregular 'paramswrappernews_item', 'paramswrappernews'
|
||||||
|
end
|
||||||
|
|
||||||
with_default_wrapper_options do
|
with_default_wrapper_options do
|
||||||
@request.env['CONTENT_TYPE'] = 'application/json'
|
@request.env['CONTENT_TYPE'] = 'application/json'
|
||||||
post :parse, { 'username' => 'sikachu', 'test_attr' => 'test_value' }
|
post :parse, { 'username' => 'sikachu', 'test_attr' => 'test_value' }
|
||||||
assert_parameters({ 'username' => 'sikachu', 'test_attr' => 'test_value', 'paramswrappernews_item' => { 'test_attr' => 'test_value' }})
|
assert_parameters({ 'username' => 'sikachu', 'test_attr' => 'test_value', 'paramswrappernews_item' => { 'test_attr' => 'test_value' }})
|
||||||
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue