aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorTim Gildea <tgildea@gmail.com>2011-07-14 11:16:28 -0400
committerVijay Dev <vijaydev.cse@gmail.com>2012-02-04 18:25:54 +0530
commit6fa0190fe4c1bf9f8306198536306de883039a27 (patch)
treeb3d7f929a65a0806d69b0605711691d71ceb71c6 /activesupport/test
parent7a72fdc7dcbb58a58b67944f8c1dfeae5cb6ed23 (diff)
downloadrails-6fa0190fe4c1bf9f8306198536306de883039a27.tar.gz
rails-6fa0190fe4c1bf9f8306198536306de883039a27.tar.bz2
rails-6fa0190fe4c1bf9f8306198536306de883039a27.zip
Add ActiveSupport::Inflector.ordinal and Integer#ordinal
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/integer_ext_test.rb6
-rw-r--r--activesupport/test/inflector_test.rb6
2 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb
index 7597f9c6f5..f01629f5c7 100644
--- a/activesupport/test/core_ext/integer_ext_test.rb
+++ b/activesupport/test/core_ext/integer_ext_test.rb
@@ -22,4 +22,10 @@ class IntegerExtTest < ActiveSupport::TestCase
assert_equal '1st', 1.ordinalize
assert_equal '8th', 8.ordinalize
end
+
+ def test_ordinal
+ assert_equal 'st', 1.ordinal
+ assert_equal 'th', 8.ordinal
+ 1000000000000000000000000000000000000000000000000000000000000000000000.ordinal
+ end
end
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index 3311d58254..e7c671778a 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -304,6 +304,12 @@ class InflectorTest < ActiveSupport::TestCase
def test_ordinal
OrdinalNumbers.each do |number, ordinalized|
+ assert_equal(ordinalized, number + ActiveSupport::Inflector.ordinal(number))
+ end
+ end
+
+ def test_ordinalize
+ OrdinalNumbers.each do |number, ordinalized|
assert_equal(ordinalized, ActiveSupport::Inflector.ordinalize(number))
end
end