mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
First pass
This commit is contained in:
@@ -3,9 +3,13 @@ require 'rails_helper'
|
||||
describe TagsController do
|
||||
describe 'show_latest' do
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
let(:other_tag) { Fabricate(:tag) }
|
||||
let(:category) { Fabricate(:category) }
|
||||
let(:subcategory) { Fabricate(:category, parent_category_id: category.id) }
|
||||
|
||||
let(:single_tag_topic) { Fabricate(:topic, tags: [tag]) }
|
||||
let(:multi_tag_topic) { Fabricate(:topic, tags: [tag, other_tag]) }
|
||||
|
||||
context 'tagging disabled' do
|
||||
it "returns 404" do
|
||||
xhr :get, :show_latest, tag_id: tag.name
|
||||
@@ -23,6 +27,14 @@ describe TagsController do
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "can filter by multiple tags" do
|
||||
single_tag_topic; multi_tag_topic
|
||||
xhr :get, :show_latest, tag_id: tag.name, secondary_tag_id: other_tag.name
|
||||
expect(response).to be_success
|
||||
expect(assigns(:list).topics).to include multi_tag_topic
|
||||
expect(assigns(:list).topics).to_not include single_tag_topic
|
||||
end
|
||||
|
||||
it "can filter by category and tag" do
|
||||
xhr :get, :show_latest, tag_id: tag.name, category: category.slug
|
||||
expect(response).to be_success
|
||||
|
||||
Reference in New Issue
Block a user