spec/enumerable/sum_spec.rb in simple_stats-1.0.0 vs spec/enumerable/sum_spec.rb in simple_stats-1.1.0
- old
+ new
@@ -21,7 +21,13 @@
sum = data.sum
sum.should == expected
sum.class.should == expected.class
end
end
+
+ it "calls map first if a block is given" do
+ f = Struct.new(:x)
+ data = [f.new(4), f.new(1), f.new(6)]
+ data.sum(&:x).should == 11
+ end
end
end
\ No newline at end of file