Support multi-group user search

This commit is contained in:
romanrizzi
2019-05-10 12:35:36 -03:00
committed by Guo Xiang Tan
parent 8728850452
commit e7ee556e87
6 changed files with 75 additions and 13 deletions

View File

@@ -51,10 +51,22 @@ describe UserSearch do
_samantha = Fabricate(:user, username: 'samantha')
group.add(sam)
results = search_for("sam", group: group)
results = search_for("sam", groups: [group])
expect(results.count).to eq(1)
end
it 'allows filtering by multiple groups' do
group_1 = Fabricate(:group)
sam = Fabricate(:user, username: 'sam')
group_2 = Fabricate(:group)
samantha = Fabricate(:user, username: 'samantha')
group_1.add(sam)
group_2.add(samantha)
results = search_for("sam", groups: [group_1, group_2])
expect(results.count).to eq(2)
end
# this is a seriously expensive integration test,
# re-creating this entire test db is too expensive reuse
it "operates correctly" do