searchable: refactor where_operator method.

Refactor the `where_operator` method so we can use it to avoid raw SQL
in more places.
This commit is contained in:
evazion
2021-01-11 18:43:15 -06:00
parent 6d2eeb6f28
commit e7b454686e
2 changed files with 37 additions and 27 deletions

View File

@@ -66,6 +66,11 @@ class SearchableTest < ActiveSupport::TestCase
assert_search_equals(@p1, source_ilike: "A*")
assert_search_equals(@p1, source_regex: "^a.*")
assert_search_equals([], id: @p1.id, source_like: "A*")
assert_search_equals([@p1], id: @p1.id, source_not_like: "A*")
assert_search_equals([], id: @p1.id, source_regex: "^A.*")
assert_search_equals([@p1], id: @p1.id, source_not_regex: "^A.*")
assert_search_equals(@p1, source_array: ["a1", "blah"])
assert_search_equals(@p1, source_comma: "a1,blah")
assert_search_equals(@p1, source_space: "a1 blah")