mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FIX: categories page would sometimes show no topics, even if there are some visible topics to show
This commit is contained in:
@ -34,9 +34,10 @@ describe CategoryFeaturedTopic do
|
||||
|
||||
|
||||
it 'should feature stuff in the correct order' do
|
||||
SiteSetting.stubs(:category_featured_topics).returns(3)
|
||||
SiteSetting.stubs(:category_featured_topics).returns(2)
|
||||
|
||||
category = Fabricate(:category)
|
||||
t5 = Fabricate(:topic, category_id: category.id, bumped_at: 12.minutes.ago)
|
||||
t4 = Fabricate(:topic, category_id: category.id, bumped_at: 10.minutes.ago)
|
||||
t3 = Fabricate(:topic, category_id: category.id, bumped_at: 7.minutes.ago)
|
||||
t2 = Fabricate(:topic, category_id: category.id, bumped_at: 4.minutes.ago)
|
||||
@ -45,9 +46,10 @@ describe CategoryFeaturedTopic do
|
||||
|
||||
CategoryFeaturedTopic.feature_topics_for(category)
|
||||
|
||||
# Should find more than we need: pinned topics first, then category_featured_topics * 2
|
||||
expect(
|
||||
CategoryFeaturedTopic.where(category_id: category.id).pluck(:topic_id)
|
||||
).to eq([pinned.id, t2.id, t1.id, t3.id])
|
||||
).to eq([pinned.id, t2.id, t1.id, t3.id, t4.id])
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user