mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
rename topic_list.tags to topic_list.top_tags
This commit is contained in:
@ -46,12 +46,12 @@ describe TopicList do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#tags' do
|
||||
describe '#top_tags' do
|
||||
it 'should return the right tags' do
|
||||
tag = Fabricate(:tag, topics: [topic])
|
||||
other_tag = Fabricate(:tag, topics: [topic], name: "use-anywhere")
|
||||
output = [tag.name, other_tag.name]
|
||||
expect(topic_list.tags.sort).to eq(output.sort)
|
||||
expect(topic_list.top_tags.sort).to eq(output.sort)
|
||||
end
|
||||
|
||||
describe 'when there are tags restricted to a category' do
|
||||
@ -63,18 +63,18 @@ describe TopicList do
|
||||
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
|
||||
expect(topic_list.tags).to eq([tag.name])
|
||||
expect(topic_list.top_tags).to eq([tag.name])
|
||||
end
|
||||
|
||||
it "with no category, should return all tags" do
|
||||
expect(TopicList.new('latest', other_topic.user, [other_topic]).tags.sort).to eq([tag.name, other_tag.name].sort)
|
||||
expect(TopicList.new('latest', other_topic.user, [other_topic]).top_tags.sort).to eq([tag.name, other_tag.name].sort)
|
||||
end
|
||||
|
||||
it "with another category with no tags, should return no tags" do
|
||||
other_category = Fabricate(:category)
|
||||
topic3 = Fabricate(:topic, category: other_category)
|
||||
list = TopicList.new('latest', topic3.user, [topic3], category: other_category.id, category_id: other_category.id)
|
||||
expect(list.tags).to be_empty
|
||||
expect(list.top_tags).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user