Skip to content

Commit

Permalink
Add: #744 in:library のテストコード (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode authored Jun 10, 2024
1 parent 23f2e17 commit 3d0f569
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/search/services/statuses_search_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit 3d0f569

Please sign in to comment.