mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
WIP: Tags which are not allowed in a category showing in drop down.
This commit is contained in:
@@ -36,4 +36,28 @@ describe TopicList do
|
||||
expect(topic_list.preloaded_custom_fields).to eq(Set.new([DiscourseTagging::TAGS_FIELD_NAME]))
|
||||
end
|
||||
end
|
||||
|
||||
describe '#tags' do
|
||||
let(:tag) { Fabricate(:tag, topics: [topic]) }
|
||||
let(:other_tag) { Fabricate(:tag, topics: [topic]) }
|
||||
|
||||
it 'should return the right tags' do
|
||||
output = [tag.name, other_tag.name]
|
||||
expect(topic_list.tags.sort).to eq(output.sort)
|
||||
end
|
||||
|
||||
describe 'when topic list is filtered by category' do
|
||||
let(:category) { Fabricate(:category) }
|
||||
let(:topic) { Fabricate(:topic, category: category) }
|
||||
let(:tag) { Fabricate(:tag, topics: [topic], categories: [category]) }
|
||||
let(:topic_list) { TopicList.new('latest', topic.user, [topic], { category: category.id, category_id: category.id }) }
|
||||
|
||||
it 'should only return tags allowed in the category' do
|
||||
other_tag
|
||||
output = [tag.name]
|
||||
|
||||
expect(topic_list.tags).to eq(output)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user