提交 42fe9489 编写于 作者: Y Yves Senn

Merge pull request #15316 from akshay-vishnoi/test-cases

Fix test cases for inflector.rb
...@@ -498,10 +498,10 @@ def test_clear_with_default ...@@ -498,10 +498,10 @@ def test_clear_with_default
end end
%w(plurals singulars uncountables humans acronyms).each do |scope| %w(plurals singulars uncountables humans acronyms).each do |scope|
ActiveSupport::Inflector.inflections do |inflect|
define_method("test_clear_inflections_with_#{scope}") do define_method("test_clear_inflections_with_#{scope}") do
with_dup do with_dup do
# clear the inflections # clear the inflections
ActiveSupport::Inflector.inflections do |inflect|
inflect.clear(scope) inflect.clear(scope)
assert_equal [], inflect.send(scope) assert_equal [], inflect.send(scope)
end end
...@@ -516,9 +516,10 @@ def test_clear_with_default ...@@ -516,9 +516,10 @@ def test_clear_with_default
# there are module functions that access ActiveSupport::Inflector.inflections, # there are module functions that access ActiveSupport::Inflector.inflections,
# so we need to replace the singleton itself. # so we need to replace the singleton itself.
def with_dup def with_dup
original = ActiveSupport::Inflector::Inflections.instance_variable_get(:@__instance__) original = ActiveSupport::Inflector::Inflections.instance_variable_get(:@__instance__)[:en]
ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, original.dup) ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original.dup)
yield
ensure ensure
ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, original) ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original)
end end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册