Commit 92d69dfb60072f1243c2304ae6958add800cf0c1
1 parent
76dfee56
Exists in
master
and in
21 other branches
Test where with arrays
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
test/sql_test.rb
... | ... | @@ -31,7 +31,7 @@ class TestSql < Minitest::Unit::TestCase |
31 | 31 | def test_where |
32 | 32 | now = Time.now |
33 | 33 | store [ |
34 | - {name: "Product A", store_id: 1, in_stock: true, backordered: true, created_at: now, orders_count: 4}, | |
34 | + {name: "Product A", store_id: 1, in_stock: true, backordered: true, created_at: now, orders_count: 4, user_ids: [1, 2, 3]}, | |
35 | 35 | {name: "Product B", store_id: 2, in_stock: true, backordered: false, created_at: now - 1, orders_count: 3}, |
36 | 36 | {name: "Product C", store_id: 3, in_stock: false, backordered: true, created_at: now - 2, orders_count: 2}, |
37 | 37 | {name: "Product D", store_id: 4, in_stock: false, backordered: false, created_at: now - 3, orders_count: 1}, |
... | ... | @@ -54,6 +54,8 @@ class TestSql < Minitest::Unit::TestCase |
54 | 54 | assert_search "product", ["Product B", "Product C", "Product D"], where: {store_id: {not: 1}} |
55 | 55 | assert_search "product", ["Product C", "Product D"], where: {store_id: {not: [1, 2]}} |
56 | 56 | assert_search "product", ["Product A", "Product B", "Product C"], where: {or: [[{in_stock: true}, {store_id: 3}]]} |
57 | + # array | |
58 | + assert_search "product", ["Product A"], where: {user_ids: 2} | |
57 | 59 | end |
58 | 60 | |
59 | 61 | def test_where_string | ... | ... |