From 3d0f5697a1ab5ef4051694deb164709107f3f385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Mon, 10 Jun 2024 23:19:00 +0900 Subject: [PATCH] =?UTF-8?q?Add:=20#744=20`in:library`=20=E3=81=AE=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=B3=E3=83=BC=E3=83=89=20(#758)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/statuses_search_service_spec.rb | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/search/services/statuses_search_service_spec.rb b/spec/search/services/statuses_search_service_spec.rb index 2d14d94292908f..abbe28f7150257 100644 --- a/spec/search/services/statuses_search_service_spec.rb +++ b/spec/search/services/statuses_search_service_spec.rb @@ -221,14 +221,16 @@ let(:search_keyword) { 'ohagi' } let(:status_text) { 'I ate an apple.' } + let(:searchability) { :public } let(:alice) { Fabricate(:user).account } let(:account) { alice } - let!(:status) { Fabricate(:status, text: status_text, account: alice, searchability: :public) } + let!(:status) { Fabricate(:status, text: status_text, account: alice, searchability: searchability) } before do alice.update!(username: 'alice') StatusesIndex.import! + PublicStatusesIndex.import! end shared_examples 'hit status' do |name, keyword| @@ -263,6 +265,22 @@ it_behaves_like 'hit status', 'when specify user name', 'apple from:alice' it_behaves_like 'does not hit status', 'when specify not existing user name', 'apple from:ohagi' + context 'when indexable is enabled' do + let(:account) { Fabricate(:user).account } + let(:alice) { Fabricate(:user, account: Fabricate(:account, indexable: true)).account } + let(:searchability) { nil } + + it_behaves_like 'hit status', 'when scope is all statuses', 'apple' + it_behaves_like 'does not hit status', 'when in:library is specified', 'apple in:library' + it_behaves_like 'hit status', 'when in:public is specified', 'apple in:public' + + context 'with public searchability' do + let(:searchability) { :public } + + it_behaves_like 'hit status', 'when scope is all public_searchability statuses', 'apple in:library' + end + end + context 'when in:following is specified' do let(:following) { Fabricate(:user).account } let(:other) { Fabricate(:user).account }