about summary refs log tree commit diff
path: root/spec/services/account_search_service_spec.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-04-01 21:28:31 +0200
committerThibaut Girka <thib@sitedethib.com>2019-04-01 21:28:31 +0200
commit12dae9d58316bec32adaac016998ab1cf69d2b45 (patch)
tree4ddadcc66d07a1edfcfb9ff0f9cda7cf107d6b46 /spec/services/account_search_service_spec.rb
parent925830d11bb5c132e282f82bdb2ca893d87c9c24 (diff)
parent120544067fcca4bf6e71ba1ffb276c451c17c656 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/models/form/admin_settings.rb
- config/locales/ja.yml
Diffstat (limited to 'spec/services/account_search_service_spec.rb')
-rw-r--r--spec/services/account_search_service_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb
index 7b071b378..40ef4b84a 100644
--- a/spec/services/account_search_service_spec.rb
+++ b/spec/services/account_search_service_spec.rb
@@ -156,5 +156,22 @@ describe AccountSearchService, type: :service do
         expect(results).to eq []
       end
     end
+
+    describe 'should not include accounts blocking the requester' do
+      let!(:blocked) { Fabricate(:account) }
+      let!(:blocker) { Fabricate(:account, username: 'exact') }
+
+      before do
+        blocker.block!(blocked)
+      end
+
+      it 'returns the fuzzy match first, and does not return suspended exacts' do
+        partial = Fabricate(:account, username: 'exactness')
+
+        results = subject.call('exact', blocked, limit: 10)
+        expect(results.size).to eq 1
+        expect(results).to eq [partial]
+      end
+    end
   end
 end