From e046fc2c5e40e965cdd7b5f2ceaf197cd3eb67b4 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 20 Jan 2016 20:59:24 -0800 Subject: [PATCH] Added failing test for count method --- test/test_helper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 2d6a3eb..0440384 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -17,6 +17,10 @@ ActiveRecord::Base.time_zone_aware_attributes = true class User < ActiveRecord::Base has_many :posts + + def self.count_method + count + end end class Post < ActiveRecord::Base @@ -809,6 +813,16 @@ module TestGroupdate assert_equal expected, User.group_by_year(:created_at, last: 2, default_value: nil).count end + # method + + def test_method + user = create_user("2014-03-01 00:00:00 UTC") + expected = { + utc.parse("2014-01-01 00:00:00 UTC") => 1 + } + assert_equal expected, User.group_by_year(:created_at).count_method + end + # associations def test_associations -- libgit2 0.21.0