Commit fc42d8ac3e2e9590e6038bae93f8dcc2c5b33ab1
1 parent
2002ad39
Exists in
master
and in
17 other branches
Test string operators [skip ci]
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
test/where_test.rb
@@ -76,6 +76,18 @@ class WhereTest < Minitest::Test | @@ -76,6 +76,18 @@ class WhereTest < Minitest::Test | ||
76 | assert_search "product", ["Product B"], where: {user_ids: {_not: [3, nil]}} | 76 | assert_search "product", ["Product B"], where: {user_ids: {_not: [3, nil]}} |
77 | end | 77 | end |
78 | 78 | ||
79 | + def test_where_string_operators | ||
80 | + store [ | ||
81 | + {name: "Product A", store_id: 1}, | ||
82 | + {name: "Product B", store_id: 2} | ||
83 | + ] | ||
84 | + | ||
85 | + error = assert_raises RuntimeError do | ||
86 | + assert_search "product", [], where: {store_id: {"lt" => 2}} | ||
87 | + end | ||
88 | + assert_includes error.message, "Unknown where operator" | ||
89 | + end | ||
90 | + | ||
79 | def test_regexp | 91 | def test_regexp |
80 | store_names ["Product A"] | 92 | store_names ["Product A"] |
81 | assert_search "*", ["Product A"], where: {name: /\APro.+\z/} | 93 | assert_search "*", ["Product A"], where: {name: /\APro.+\z/} |