Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add spec for searching for whisper posts.

Guo Xiang Tan309e41d3418e
diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb
index f01fed5221c..d0def198fbc 100644
--- a/spec/components/search_spec.rb
+++ b/spec/components/search_spec.rb
@@ -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