DEV: Add spec for searching for whisper posts.

This commit is contained in:
Guo Xiang Tan 2020-07-27 11:55:54 +08:00
parent f2342c2d32
commit 309e41d341
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 17 additions and 1 deletions

View File

@ -395,7 +395,11 @@ describe Search do
end
context 'posts' do
let(:post) { Fabricate(:post) }
fab!(:post) do
SearchIndexer.enable
Fabricate(:post)
end
let(:topic) { post.topic }
let!(:reply) do
@ -488,6 +492,18 @@ describe Search do
ensure
Discourse.cache.clear
end
it 'allows staff to search for whispers' do
post.update!(post_type: Post.types[:whisper], raw: 'this is a tiger')
results = Search.execute('tiger')
expect(results.posts).to eq([])
results = Search.execute('tiger', guardian: Guardian.new(admin))
expect(results.posts).to eq([post])
end
end
context 'topics' do