aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/enumerable_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-01-09 08:37:36 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-01-09 08:37:36 +0000
commite9b862acb02f9b6a507023e493a9abb2a2fb62da (patch)
tree99b2e6a488bff56f540136f03ede39bbe043c67a /activesupport/test/core_ext/enumerable_test.rb
parent7e56c72fae45f26b1ec2acbd20d404b189852a77 (diff)
downloadrails-e9b862acb02f9b6a507023e493a9abb2a2fb62da.tar.gz
rails-e9b862acb02f9b6a507023e493a9abb2a2fb62da.tar.bz2
rails-e9b862acb02f9b6a507023e493a9abb2a2fb62da.zip
Fix up Enumerable#group_by
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8604 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/enumerable_test.rb')
-rw-r--r--activesupport/test/core_ext/enumerable_test.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index 97e3ff6377..234dc98de8 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -15,9 +15,13 @@ class EnumerableTests < Test::Unit::TestCase
people << p
end
- objects.group_by {|object| object.name}.each do |name, group|
- assert group.all? {|person| person.name == name}
+ grouped = objects.group_by { |object| object.name }
+
+ grouped.each do |name, group|
+ assert group.all? { |person| person.name == name }
end
+
+ assert_equal objects.uniq.map(&:name), grouped.map { |name, group| name }
end
def test_sums