Add search form for hidden content

Added search for comments and proposal_notifications, added tsv column
for search and rake tasks to update/create tsv vector.
This commit is contained in:
Jacek Skrzypacz
2019-03-20 11:35:41 +01:00
committed by Javi Martín
parent e66b9687a2
commit 2af7e32415
19 changed files with 254 additions and 2 deletions

View File

@@ -193,4 +193,25 @@ describe Comment do
expect(Comment.public_for_api).to be_empty
end
end
describe ".search" do
it "searches by body" do
comment = create(:comment, body: "I agree")
expect(Comment.search("agree")).to eq([comment])
end
it "searches by commentable title" do
proposal = create(:proposal, title: "More wood!")
comment = create(:comment, body: "I agree", commentable: proposal)
expect(Comment.search("wood")).to eq([comment])
end
it "does not return non-matching records" do
create(:comment, body: "I agree")
expect(Comment.search("disagree")).to be_empty
end
end
end