test/enumerable_test.rb in groupdate-2.5.3 vs test/enumerable_test.rb in groupdate-3.0.0
- old
+ new
@@ -6,14 +6,24 @@
def test_enumerable
user_a = create_user("2014-01-21")
user_b = create_user("2014-03-14")
expected = {
- utc.parse("2014-01-01") => [user_a],
- utc.parse("2014-02-01") => [],
- utc.parse("2014-03-01") => [user_b]
+ Date.parse("2014-01-01") => [user_a],
+ Date.parse("2014-03-01") => [user_b]
}
assert_equal expected, [user_a, user_b].group_by_month(&:created_at)
+ end
+
+ def test_enumerable_series
+ user_a = create_user("2014-01-21")
+ user_b = create_user("2014-03-14")
+ expected = {
+ Date.parse("2014-01-01") => [user_a],
+ Date.parse("2014-02-01") => [],
+ Date.parse("2014-03-01") => [user_b]
+ }
+ assert_equal expected, [user_a, user_b].group_by_month(series: true, &:created_at)
end
def test_no_block
assert_raises(ArgumentError) { [].group_by_day(:created_at) }
end