diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-17 13:37:57 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-17 17:37:29 -0500 |
commit | 22af62cf486721ee2e45bb720c42ac2f4121faf4 (patch) | |
tree | 155c0f6bb42effe927953956140b7b1243f7e05c /activesupport/test | |
parent | 7650ff892cbffcaaaf9c5ab72466e98903a202d3 (diff) | |
download | rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.tar.gz rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.tar.bz2 rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.zip |
Added Array#second through Array#tenth as aliases for Array#[1] through Array#[9] [DHH]
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 73fbeb8b6b..7563be44f8 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -13,6 +13,20 @@ class ArrayExtAccessTests < Test::Unit::TestCase assert_equal %w( a b c ), %w( a b c d ).to(2) assert_equal %w( a b c d ), %w( a b c d ).to(10) end + + def test_second_through_tenth + array = (1..10).to_a + + assert_equal array[1], array.second + assert_equal array[2], array.third + assert_equal array[3], array.fourth + assert_equal array[4], array.fifth + assert_equal array[5], array.sixth + assert_equal array[6], array.seventh + assert_equal array[7], array.eighth + assert_equal array[8], array.ninth + assert_equal array[9], array.tenth + end end class ArrayExtToParamTests < Test::Unit::TestCase |