From 725817e53acbfea64d6133dfaefe1fc68bbaeb6b Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 22 Dec 2010 09:08:20 +0100 Subject: [PATCH] Ensure that uncountable are removed after test --- activesupport/test/inflector_test.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index e8fe635c0394d..60714a152d2c2 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -21,7 +21,7 @@ def test_pluralize_plurals def test_pluralize_empty_string assert_equal "", ActiveSupport::Inflector.pluralize("") end - + ActiveSupport::Inflector.inflections.uncountable.each do |word| define_method "test_uncountability_of_#{word}" do assert_equal word, ActiveSupport::Inflector.singularize(word) @@ -29,13 +29,13 @@ def test_pluralize_empty_string assert_equal ActiveSupport::Inflector.pluralize(word), ActiveSupport::Inflector.singularize(word) end end - + def test_uncountable_word_is_not_greedy uncountable_word = "ors" countable_word = "sponsor" - + cached_uncountables = ActiveSupport::Inflector.inflections.uncountables - + ActiveSupport::Inflector.inflections.uncountable << uncountable_word assert_equal uncountable_word, ActiveSupport::Inflector.singularize(uncountable_word) @@ -45,7 +45,8 @@ def test_uncountable_word_is_not_greedy assert_equal "sponsor", ActiveSupport::Inflector.singularize(countable_word) assert_equal "sponsors", ActiveSupport::Inflector.pluralize(countable_word) assert_equal "sponsor", ActiveSupport::Inflector.singularize(ActiveSupport::Inflector.pluralize(countable_word)) - + + ensure ActiveSupport::Inflector.inflections.instance_variable_set :@uncountables, cached_uncountables end