diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-17 07:02:39 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-17 07:02:39 -0700 |
commit | 59d6df5c695bba671e5e670520f8c5afa5ad193e (patch) | |
tree | 641e67bb986d6d813249b0f2fda7b35a693398e8 /activesupport/test | |
parent | 8dffc62a9b957c91575f7c014f50806e86d64505 (diff) | |
parent | 4535191c61b496b1a5e9dc57624581753fa71497 (diff) | |
download | rails-59d6df5c695bba671e5e670520f8c5afa5ad193e.tar.gz rails-59d6df5c695bba671e5e670520f8c5afa5ad193e.tar.bz2 rails-59d6df5c695bba671e5e670520f8c5afa5ad193e.zip |
Merge pull request #3151 from zenprogrammer/pluralize_without_count
Added include_count parameter to pluralize.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 5c1dddaf96..4d876954cf 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -20,7 +20,7 @@ end class StringInflectionsTest < Test::Unit::TestCase include InflectorTestCases include ConstantizeTestCases - + def test_erb_escape string = [192, 60].pack('CC') expected = 192.chr + "<" @@ -64,6 +64,10 @@ class StringInflectionsTest < Test::Unit::TestCase end assert_equal("plurals", "plurals".pluralize) + + assert_equal("blargles", "blargle".pluralize(0)) + assert_equal("blargle", "blargle".pluralize(1)) + assert_equal("blargles", "blargle".pluralize(2)) end def test_singularize @@ -301,13 +305,13 @@ class StringInflectionsTest < Test::Unit::TestCase "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8').truncate(10) end end - + def test_constantize run_constantize_tests_on do |string| string.constantize end end - + def test_safe_constantize run_safe_constantize_tests_on do |string| string.safe_constantize @@ -381,7 +385,7 @@ class OutputSafetyTest < ActiveSupport::TestCase test "A fixnum is safe by default" do assert 5.html_safe? end - + test "a float is safe by default" do assert 5.7.html_safe? end |