diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 55fdcf32ce..0ff2eb1c81 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -46,18 +46,16 @@ class EnumerableTests < Test::Unit::TestCase assert_equal 60, payments.sum { |p| p.price.to_i * 2 } end - + def test_empty_sums assert_equal 0, [].sum assert_equal 0, [].sum { |i| i } assert_equal Payment.new(0), [].sum(Payment.new(0)) end - + def test_index_by payments = [ Payment.new(5), Payment.new(15), Payment.new(10) ] - assert_equal( - {5 => payments[0], 15 => payments[1], 10 => payments[2]}, - payments.index_by(&:price) - ) + assert_equal({ 5 => payments[0], 15 => payments[1], 10 => payments[2] }, + payments.index_by { |p| p.price }) end end |