aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/inflector_test.rb
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-12-22 09:08:20 +0100
committerPiotr Sarnacki <drogus@gmail.com>2010-12-22 09:44:46 +0100
commit1a2c4279913a2af895b03465d4486c51dc61d138 (patch)
treeab3f25ab1e49eba397f00ced36ee422ff508b05e /activesupport/test/inflector_test.rb
parent9b4622a483319f3d1e7f4489442f0d86afb6da36 (diff)
downloadrails-1a2c4279913a2af895b03465d4486c51dc61d138.tar.gz
rails-1a2c4279913a2af895b03465d4486c51dc61d138.tar.bz2
rails-1a2c4279913a2af895b03465d4486c51dc61d138.zip
Ensure that uncountable are removed after test
Diffstat (limited to 'activesupport/test/inflector_test.rb')
-rw-r--r--activesupport/test/inflector_test.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index e8fe635c03..60714a152d 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -21,7 +21,7 @@ class InflectorTest < Test::Unit::TestCase
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 @@ class InflectorTest < Test::Unit::TestCase
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 @@ class InflectorTest < Test::Unit::TestCase
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