Reduce number of records in pagination tests

Creating more than 25 records isn't necessary to test pagination; we can
stub the number of records per page in a test.

On my machine we save about one second per test with these changes.
This commit is contained in:
Javi Martín
2019-11-10 14:12:21 +01:00
parent 2228ac3781
commit bd03e249ce
19 changed files with 40 additions and 29 deletions

View File

@@ -80,8 +80,8 @@ describe "Admin proposal notifications" do
end
scenario "Action links remember the pagination setting and the filter" do
per_page = Kaminari.config.default_per_page
(per_page + 2).times { create(:proposal_notification, :hidden, :with_confirmed_hide) }
allow(ProposalNotification).to receive(:default_per_page).and_return(2)
4.times { create(:proposal_notification, :hidden, :with_confirmed_hide) }
visit admin_proposal_notifications_path(filter: "with_confirmed_hide", page: 2)