diff options
author | Emelia Smith <ThisIsMissEm@users.noreply.github.com> | 2018-04-23 21:27:18 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-04-23 21:27:18 +0200 |
commit | 495303d9b86919c72bf1948a714bf8d00b41fa0f (patch) | |
tree | b8bc50013a96a73b63b3bd4e79b242cc4a75f3b6 /spec | |
parent | 53b1d8887325160934dec7557e97a43ce2896264 (diff) |
Prevent suspended accounts from appearing in AccountSearchService (#7246)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/account_search_service_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb index 9bb27edad..c5ddc5844 100644 --- a/spec/services/account_search_service_spec.rb +++ b/spec/services/account_search_service_spec.rb @@ -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 |