Skip to content

Commit 7abe866

Browse files
committed
Added more tests for smart_aggs
1 parent cf938ae commit 7abe866

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
- Added `per` method
44
- Fixed error with `aggs` method and non-hash arguments
5-
- Fixed smart aggs not applying to `_and`, `_or`, and `_not`
65
- Fixed smart aggs not applying when multiple `where` calls
76

87
## 6.0.3 (2026-01-06)

test/aggs_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ def test_smart_aggs
144144
assert_aggs ({"store_id" => {1 => 1}}), where: {in_stock: true}, aggs: [:store_id]
145145
assert_aggs ({"store_id" => {1 => 1, 2 => 2}}), where: {in_stock: true}, aggs: [:store_id], smart_aggs: false
146146

147+
assert_aggs ({"store_id" => {2 => 2}}), where: {_not: {in_stock: true}}, aggs: [:store_id]
148+
assert_aggs ({"store_id" => {1 => 1, 2 => 2}}), where: {_not: {in_stock: true}}, aggs: [:store_id], smart_aggs: false
149+
150+
assert_aggs ({"store_id" => {1 => 1}}), where: {_and: [{in_stock: true}]}, aggs: [:store_id]
151+
assert_aggs ({"store_id" => {1 => 1, 2 => 2}}), where: {_and: [{in_stock: true}]}, aggs: [:store_id], smart_aggs: false
152+
153+
assert_aggs ({"store_id" => {1 => 1}}), where: {_or: [{in_stock: true}]}, aggs: [:store_id]
154+
assert_aggs ({"store_id" => {1 => 1, 2 => 2}}), where: {_or: [{in_stock: true}]}, aggs: [:store_id], smart_aggs: false
155+
147156
assert_aggs ({"store_id" => {2 => 1}}), where: {color: "red"}, aggs: {store_id: {where: {in_stock: false}}}
148157
assert_aggs ({"store_id" => {2 => 2}}), where: {color: "red"}, aggs: {store_id: {where: {in_stock: false}}}, smart_aggs: false
149158

0 commit comments

Comments
 (0)