FIX: in:title search should only search through topic first posts.

This commit is contained in:
Guo Xiang Tan
2020-07-16 12:21:19 +08:00
parent 84de643c04
commit af87911178
2 changed files with 5 additions and 9 deletions

View File

@@ -1513,19 +1513,14 @@ describe Search do
context 'in:title' do
it 'allows for search in title' do
topic = Fabricate(:topic, title: 'I am testing a title search')
_post = Fabricate(:post, topic: topic, raw: 'this is the first post')
post2 = Fabricate(:post, topic: topic, raw: 'this is the second post', post_number: 2)
post = Fabricate(:post, topic: topic, raw: 'this is the first post', post_number: 1)
results = Search.execute('title in:title')
expect(results.posts.length).to eq(1)
results = Search.execute('title t')
expect(results.posts.length).to eq(1)
expect(results.posts.map(&:id)).to eq([post.id])
results = Search.execute('first in:title')
expect(results.posts.length).to eq(0)
results = Search.execute('first t')
expect(results.posts.length).to eq(0)
expect(results.posts).to eq([])
end
it 'works irrespective of the order' do