parent
23f2e17d66
commit
3d0f5697a1
1 changed files with 19 additions and 1 deletions
|
@ -221,14 +221,16 @@ describe StatusesSearchService do
|
||||||
|
|
||||||
let(:search_keyword) { 'ohagi' }
|
let(:search_keyword) { 'ohagi' }
|
||||||
let(:status_text) { 'I ate an apple.' }
|
let(:status_text) { 'I ate an apple.' }
|
||||||
|
let(:searchability) { :public }
|
||||||
|
|
||||||
let(:alice) { Fabricate(:user).account }
|
let(:alice) { Fabricate(:user).account }
|
||||||
let(:account) { alice }
|
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
|
before do
|
||||||
alice.update!(username: 'alice')
|
alice.update!(username: 'alice')
|
||||||
StatusesIndex.import!
|
StatusesIndex.import!
|
||||||
|
PublicStatusesIndex.import!
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'hit status' do |name, keyword|
|
shared_examples 'hit status' do |name, keyword|
|
||||||
|
@ -263,6 +265,22 @@ describe StatusesSearchService do
|
||||||
it_behaves_like 'hit status', 'when specify user name', 'apple from:alice'
|
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'
|
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
|
context 'when in:following is specified' do
|
||||||
let(:following) { Fabricate(:user).account }
|
let(:following) { Fabricate(:user).account }
|
||||||
let(:other) { Fabricate(:user).account }
|
let(:other) { Fabricate(:user).account }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue