|
|
|
@ -137,5 +137,24 @@ describe AccountSearchService do |
|
|
|
|
expect(service).not_to have_received(:call) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'should not include suspended accounts' do |
|
|
|
|
it 'returns the fuzzy match first, and does not return suspended exacts' do |
|
|
|
|
partial = Fabricate(:account, username: 'exactness') |
|
|
|
|
exact = Fabricate(:account, username: 'exact', suspended: true) |
|
|
|
|
|
|
|
|
|
results = subject.call('exact', 10) |
|
|
|
|
expect(results.size).to eq 1 |
|
|
|
|
expect(results).to eq [partial] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not return suspended remote accounts" do |
|
|
|
|
remote = Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true) |
|
|
|
|
|
|
|
|
|
results = subject.call('a@example.com', 2) |
|
|
|
|
expect(results.size).to eq 0 |
|
|
|
|
expect(results).to eq [] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|