increases tag limit to 10

This commit is contained in:
rgarcia
2016-01-27 14:17:32 +01:00
parent 5d4b6fae92
commit 209b6407d3
2 changed files with 9 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ class TagCloud
last_week.tag_counts.
where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist).
order("#{table_name}_count": :desc, name: :asc).
limit(5)
limit(10)
end
def category_names

View File

@@ -100,6 +100,14 @@ describe TagCloud do
expect(tag_names(tag_cloud).second).to eq 'participation'
expect(tag_names(tag_cloud).third).to eq 'corruption'
end
it "returns a maximum of 10 tags" do
12.times { |i| create(:proposal, tag_list: "Tag #{i}") }
tag_cloud = TagCloud.new(Proposal)
expect(tag_names(tag_cloud).count).to eq(10)
end
end
end