First pass

This commit is contained in:
James Kiesel
2016-08-11 01:38:16 -04:00
parent 823a699d41
commit 7e73b933c7
7 changed files with 43 additions and 6 deletions

View File

@@ -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