Permalink
Browse files

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

Fix test cases for inflector.rb
  • Loading branch information...
2 parents 30d4200 + 93c193e commit 42fe94891720e081149744cb8ae1e63747f1ff38 @senny senny committed May 26, 2014
Showing with 8 additions and 7 deletions.
  1. +8 −7 activesupport/test/inflector_test.rb
@@ -498,10 +498,10 @@ def test_clear_with_default
end
%w(plurals singulars uncountables humans acronyms).each do |scope|
- ActiveSupport::Inflector.inflections do |inflect|
- define_method("test_clear_inflections_with_#{scope}") do
- with_dup do
- # clear the inflections
+ define_method("test_clear_inflections_with_#{scope}") do
+ with_dup do
+ # clear the inflections
+ ActiveSupport::Inflector.inflections do |inflect|
inflect.clear(scope)
assert_equal [], inflect.send(scope)
end
@@ -516,9 +516,10 @@ def test_clear_with_default
# there are module functions that access ActiveSupport::Inflector.inflections,
# so we need to replace the singleton itself.
def with_dup
- original = ActiveSupport::Inflector::Inflections.instance_variable_get(:@__instance__)
- ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, original.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__, original)
+ ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original)
end
end

0 comments on commit 42fe948

Please sign in to comment.