Refactor searching text attributes.
* Allow using ApplicationRecord#attribute_matches to search text attributes, and standardize models on using this instead of duplicating code. * Remove restrictions that limited wildcard searches to Builders only in various places.
This commit is contained in:
@@ -196,13 +196,13 @@ class NoteTest < ActiveSupport::TestCase
|
||||
|
||||
context "where the body contains the string 'aaa'" do
|
||||
should "return a hit" do
|
||||
assert_equal(1, Note.body_matches("aaa").count)
|
||||
assert_equal(1, Note.search(body_matches: "aaa").count)
|
||||
end
|
||||
end
|
||||
|
||||
context "where the body contains the string 'bbb'" do
|
||||
should "return no hits" do
|
||||
assert_equal(0, Note.body_matches("bbb").count)
|
||||
assert_equal(0, Note.search(body_matches: "bbb").count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user