aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2009-04-14 01:12:55 -0400
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-08 17:51:09 -0700
commit29096268ccce2b13e1490c8b673ffe0b498555fc (patch)
tree3fdb677bca442e2967f180db42003032c7aa1912 /activesupport/test/core_ext
parent3b3798506b403911665c3c24fd055b75d6f6a44f (diff)
downloadrails-29096268ccce2b13e1490c8b673ffe0b498555fc.tar.gz
rails-29096268ccce2b13e1490c8b673ffe0b498555fc.tar.bz2
rails-29096268ccce2b13e1490c8b673ffe0b498555fc.zip
Enumerable#sum now works will all enumerables, even if they don't respond to :size
[#2489 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/enumerable_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index 885393815b..1927a0ad0d 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -60,6 +60,10 @@ class EnumerableTests < Test::Unit::TestCase
assert_equal Payment.new(0), [].sum(Payment.new(0))
end
+ def test_enumerable_sums
+ assert_equal 10, (1..4).sum
+ end
+
def test_each_with_object
result = %w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase }
assert_equal({'foo' => 'FOO', 'bar' => 'BAR'}, result)