DEV: Improve search phrase spec to show that it actually works.
This commit is contained in:
parent
bf57f39353
commit
1799820256
|
@ -850,11 +850,13 @@ describe Search do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can search numbers correctly, and match exact phrases' do
|
it 'can search numbers correctly, and match exact phrases' do
|
||||||
topic = Fabricate(:topic, created_at: 3.months.ago)
|
post = Fabricate(:post, raw: '3.0 eta is in 2 days horrah')
|
||||||
Fabricate(:post, raw: '3.0 eta is in 2 days horrah', topic: topic)
|
post2 = Fabricate(:post, raw: '3.0 is eta in 2 days horrah')
|
||||||
|
|
||||||
expect(Search.execute('3.0 eta').posts.length).to eq(1)
|
expect(Search.execute('3.0 eta').posts).to contain_exactly(post, post2)
|
||||||
expect(Search.execute('"3.0, eta is"').posts.length).to eq(0)
|
expect(Search.execute("'3.0 eta'").posts).to contain_exactly(post, post2)
|
||||||
|
expect(Search.execute("\"3.0 eta\"").posts).to contain_exactly(post)
|
||||||
|
expect(Search.execute('"3.0, eta is"').posts).to eq([])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can find by status' do
|
it 'can find by status' do
|
||||||
|
|
Loading…
Reference in New Issue