spec/enumerable/frequencies_spec.rb in simple_stats-1.0.0 vs spec/enumerable/frequencies_spec.rb in simple_stats-1.1.0
- old
+ new
@@ -23,7 +23,17 @@
frequencies = data.frequencies
frequencies.should == expected
frequencies.class.should == expected.class
end
end
+
+ it "calls map first if a block is given" do
+ f = Struct.new(:x)
+ data = [f.new(:a), f.new(:b), f.new(:b)]
+ frequencies = data.frequencies(&:x)
+ frequencies.should == {
+ :a => 1,
+ :b => 2
+ }
+ end
end
-end
\ No newline at end of file
+end