diff options
author | Marcel Molina <marcel@vernix.org> | 2006-09-02 18:02:36 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-09-02 18:02:36 +0000 |
commit | 9db407f5786d96373d1534faa79c3220685b8ae0 (patch) | |
tree | 30e9d723a1561efad51d8882f3850a14ce9f388c /activesupport/test | |
parent | 03de0cfe7ab281eda70f2cedd09659752e765acf (diff) | |
download | rails-9db407f5786d96373d1534faa79c3220685b8ae0.tar.gz rails-9db407f5786d96373d1534faa79c3220685b8ae0.tar.bz2 rails-9db407f5786d96373d1534faa79c3220685b8ae0.zip |
Don't pad remaining places with in_groups_of if specified padding value is false. [Marcel Molina Jr.]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4900 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 955b2b30c1..64c9a8b4ff 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -74,11 +74,21 @@ class ArrayExtGroupingTests < Test::Unit::TestCase def test_group_by_pads_with_specified_values groups = [] + ('a'..'g').to_a.in_groups_of(3, 'foo') do |group| + groups << group + end + + assert_equal [%w(a b c), %w(d e f), ['g', 'foo', 'foo']], groups + end + + def test_group_without_padding + groups = [] + ('a'..'g').to_a.in_groups_of(3, false) do |group| groups << group end - assert_equal [%w(a b c), %w(d e f), ['g', false, false]], groups + assert_equal [%w(a b c), %w(d e f), ['g']], groups end end |