From 9db407f5786d96373d1534faa79c3220685b8ae0 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Sat, 2 Sep 2006 18:02:36 +0000 Subject: 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 --- activesupport/test/core_ext/array_ext_test.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'activesupport/test') 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 -- cgit v1.2.3