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 }