Merge pull request #4387 from gdpelican/feature/tags-intersection

FEATURE: Tags intersection page
This commit is contained in:
Neil Lalonde
2016-08-15 16:24:29 -04:00
committed by GitHub
9 changed files with 92 additions and 11 deletions
+8
View File
@@ -145,6 +145,14 @@ describe TopicQuery do
# expect(TopicQuery.new(moderator, tags: [tag.id, other_tag.id]).list_latest.topics.map(&:id)).to eq([tagged_topic3.id].sort)
end
it "can return topics with all specified tags" do
expect(TopicQuery.new(moderator, tags: [tag.name, other_tag.name], match_all_tags: true).list_latest.topics.map(&:id)).to eq([tagged_topic3.id])
end
it "returns an empty relation when an invalid tag is passed" do
expect(TopicQuery.new(moderator, tags: [tag.name, 'notatag'], match_all_tags: true).list_latest.topics).to be_empty
end
it "can return topics with no tags" do
expect(TopicQuery.new(moderator, no_tags: true).list_latest.topics.map(&:id)).to eq([no_tags_topic.id])
end