Commit dd4c123412bb608a66540b06d25c95bdb44115e5
1 parent
5c8b4e1e
Exists in
master
and in
20 other branches
Fixed failing test
Showing
1 changed file
with
16 additions
and
13 deletions
Show diff stats
test/aggs_test.rb
... | ... | @@ -98,19 +98,22 @@ class AggsTest < Minitest::Test |
98 | 98 | |
99 | 99 | def test_aggs_group_by_date |
100 | 100 | store [{name: "Old Product", created_at: 3.years.ago}] |
101 | - aggs = Product.search( | |
102 | - "Product", | |
103 | - aggs: { | |
104 | - products_per_year: { | |
105 | - date_histogram: { | |
106 | - field: :created_at, | |
107 | - interval: :year | |
108 | - } | |
109 | - } | |
110 | - } | |
111 | - ).aggs | |
112 | - | |
113 | - assert_equal 4, aggs["products_per_year"]["buckets"].size | |
101 | + products = | |
102 | + Product.search("Product", { | |
103 | + where: { | |
104 | + created_at: {lt: Time.now} | |
105 | + }, | |
106 | + aggs: { | |
107 | + products_per_year: { | |
108 | + date_histogram: { | |
109 | + field: :created_at, | |
110 | + interval: :year | |
111 | + } | |
112 | + } | |
113 | + } | |
114 | + }) | |
115 | + | |
116 | + assert_equal 4, products.aggs["products_per_year"]["buckets"].size | |
114 | 117 | end |
115 | 118 | |
116 | 119 | protected | ... | ... |