1
0
Fork 0
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:
Zuhao Wan 2014-05-28 22:14:57 +08:00
parent 0f80a52629
commit 781f8a8a33

View file

@ -337,6 +337,7 @@ class IrregularInflectionParamsWrapperTest < ActionController::TestCase
tests ParamswrappernewsController
def test_uses_model_attribute_names_with_irregular_inflection
with_dup do
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'paramswrappernews_item', 'paramswrappernews'
end
@ -348,3 +349,14 @@ class IrregularInflectionParamsWrapperTest < ActionController::TestCase
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