Commit 8fa1bd5617873c2b596e89fba0a8d69404df240a

Authored by Andrew Kane
1 parent ad738dea

Test where [skip ci]

Showing 2 changed files with 2 additions and 1 deletions   Show diff stats
lib/searchkick/relation.rb
... ... @@ -232,7 +232,7 @@ module Searchkick
232 232  
233 233 # TODO merge options
234 234 def aggs!(*args)
235   - options[:aggs] = args
  235 + options[:aggs] = args.size == 1 ? args.first : args
236 236 self
237 237 end
238 238  
... ...
test/aggs_test.rb
... ... @@ -18,6 +18,7 @@ class AggsTest < Minitest::Test
18 18  
19 19 def test_where
20 20 assert_equal ({1 => 1}), store_agg(aggs: {store_id: {where: {in_stock: true}}})
  21 + assert_equal ({1 => 1}), buckets_as_hash(Product.search("Product", relation: true).aggs(store_id: {where: {in_stock: true}}).aggs["store_id"])
21 22 end
22 23  
23 24 def test_order
... ...