aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRyan Oblak <rroblak@gmail.com>2011-09-27 22:39:31 -0700
committerRyan Oblak <rroblak@gmail.com>2011-09-28 12:24:06 -0700
commit4535191c61b496b1a5e9dc57624581753fa71497 (patch)
treeee10fb199b2a43f4eadb6cf913d499e133bf59e6 /activesupport/test
parentc612183ad19f2c11eb58e4393a759a1016ce4c05 (diff)
downloadrails-4535191c61b496b1a5e9dc57624581753fa71497.tar.gz
rails-4535191c61b496b1a5e9dc57624581753fa71497.tar.bz2
rails-4535191c61b496b1a5e9dc57624581753fa71497.zip
Modified String#pluralize to take an optional count parameter.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb12
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 + "&lt;"
@@ -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