diff --git a/app/views/articles/_collection.html.erb b/app/views/articles/_collection.html.erb
index 525dff210..7ae45b832 100644
--- a/app/views/articles/_collection.html.erb
+++ b/app/views/articles/_collection.html.erb
@@ -20,7 +20,7 @@
data-no-instant
title="View more">
...
- <%= collection_size - 2 %> more <%= "part".pluralize(count: collection_size - 2) %>...
+ <%= collection_size - 4 %> more <%= "part".pluralize(count: collection_size - 4) %>...
<% end %>
diff --git a/spec/factories/collections.rb b/spec/factories/collections.rb
index 5a595f944..10e3e2018 100644
--- a/spec/factories/collections.rb
+++ b/spec/factories/collections.rb
@@ -5,8 +5,11 @@ FactoryBot.define do
end
trait :with_articles do
- after(:create) do |collection|
- create_list(:article, 3, with_collection: collection, user: collection.user)
+ transient do
+ amount { 3 }
+ end
+ after(:create) do |collection, evaluator|
+ create_list(:article, evaluator.amount, with_collection: collection, user: collection.user)
end
end
end
diff --git a/spec/requests/collections_spec.rb b/spec/requests/collections_spec.rb
index 8c74b2371..0e24f82ea 100644
--- a/spec/requests/collections_spec.rb
+++ b/spec/requests/collections_spec.rb
@@ -17,4 +17,15 @@ RSpec.describe "Collections", type: :request do
expect(response).to have_http_status(:ok)
end
end
+
+ describe "GET large user collection show" do
+ it "returns the proper article count and text for a large collection", :aggregate_failures do
+ amount = 6
+ large_collection = create(:collection, :with_articles, amount: amount, user: user)
+
+ get "/#{user.username}/#{large_collection.articles.first.slug}"
+ expect(response).to have_http_status(:ok)
+ expect(response.body).to include "#{amount - 4} more parts..."
+ end
+ end
end