From 6fa0190fe4c1bf9f8306198536306de883039a27 Mon Sep 17 00:00:00 2001 From: Tim Gildea Date: Thu, 14 Jul 2011 11:16:28 -0400 Subject: Add ActiveSupport::Inflector.ordinal and Integer#ordinal --- activesupport/test/core_ext/integer_ext_test.rb | 6 ++++++ activesupport/test/inflector_test.rb | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'activesupport/test') 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 @@ -303,6 +303,12 @@ class InflectorTest < ActiveSupport::TestCase end 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 -- cgit v1.2.3 From a470d796972749889a27e2070bbd95346bba45ea Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 4 Feb 2012 18:38:26 +0530 Subject: Document Integer#ordinal available in PR #2072. Also remove an unasserted line in the tests. --- activesupport/test/core_ext/integer_ext_test.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index f01629f5c7..41736fb672 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -26,6 +26,5 @@ class IntegerExtTest < ActiveSupport::TestCase def test_ordinal assert_equal 'st', 1.ordinal assert_equal 'th', 8.ordinal - 1000000000000000000000000000000000000000000000000000000000000000000000.ordinal end end -- cgit v1.2.3