Commit e046fc2c5e40e965cdd7b5f2ceaf197cd3eb67b4
1 parent
e43ad0fd
Exists in
count_method
Added failing test for count method
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
test/test_helper.rb
... | ... | @@ -17,6 +17,10 @@ ActiveRecord::Base.time_zone_aware_attributes = true |
17 | 17 | |
18 | 18 | class User < ActiveRecord::Base |
19 | 19 | has_many :posts |
20 | + | |
21 | + def self.count_method | |
22 | + count | |
23 | + end | |
20 | 24 | end |
21 | 25 | |
22 | 26 | class Post < ActiveRecord::Base |
... | ... | @@ -809,6 +813,16 @@ module TestGroupdate |
809 | 813 | assert_equal expected, User.group_by_year(:created_at, last: 2, default_value: nil).count |
810 | 814 | end |
811 | 815 | |
816 | + # method | |
817 | + | |
818 | + def test_method | |
819 | + user = create_user("2014-03-01 00:00:00 UTC") | |
820 | + expected = { | |
821 | + utc.parse("2014-01-01 00:00:00 UTC") => 1 | |
822 | + } | |
823 | + assert_equal expected, User.group_by_year(:created_at).count_method | |
824 | + end | |
825 | + | |
812 | 826 | # associations |
813 | 827 | |
814 | 828 | def test_associations | ... | ... |