From 8f7d81fde64a756a227e46746af22b99fa922bbc Mon Sep 17 00:00:00 2001 From: Jakub Macina Date: Tue, 6 Jun 2017 14:39:53 +0200 Subject: [PATCH] Add rspec test for searching posts with images. --- config/locales/client.en.yml | 2 +- spec/components/search_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 71532ab95d8..c2268368f51 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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 diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index d215c8835c3..069f602065d 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -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)