Add rspec test for searching posts with images.

This commit is contained in:
Jakub Macina 2017-06-06 14:39:53 +02:00
parent 23d67d2100
commit 8f7d81fde6
2 changed files with 11 additions and 1 deletions

View File

@ -1344,7 +1344,7 @@ en:
seen: I've read
unseen: I've not read
wiki: are wiki
images: includes image
images: includes image(s)
statuses:
label: Where topics
open: are open

View File

@ -628,6 +628,16 @@ describe Search do
end
it 'can find posts with images' do
post_uploaded = Fabricate(:post_with_uploaded_image)
post_with_image_urls = Fabricate(:post_with_image_urls)
Fabricate(:post)
TopicLink.extract_from(post_uploaded)
TopicLink.extract_from(post_with_image_urls)
expect(Search.execute('in:image').posts.map(&:id).sort).to eq([post_uploaded.id, post_with_image_urls.id].sort)
end
it 'can find by latest' do
topic1 = Fabricate(:topic, title: 'I do not like that Sam I am')
post1 = Fabricate(:post, topic: topic1)