Show correct number in series truncation. (#13799)
* Change math in collection to represent the correct number of hidden posts. * Add test for correction truncation text. * Add aggregate_failures tag to collections spec Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
This commit is contained in:
parent
d87537ab29
commit
d8cc793afe
3 changed files with 17 additions and 3 deletions
|
|
@ -20,7 +20,7 @@
|
|||
data-no-instant
|
||||
title="View more">
|
||||
<span class="series-switcher__num">...</span>
|
||||
<span class="series-switcher__title"><%= collection_size - 2 %> more <%= "part".pluralize(count: collection_size - 2) %>...</span>
|
||||
<span class="series-switcher__title"><%= collection_size - 4 %> more <%= "part".pluralize(count: collection_size - 4) %>...</span>
|
||||
</a>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue