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

@@ -37,8 +37,9 @@ describe "Documents" do
end
scenario "Index (pagination)" do
per_page = Kaminari.config.default_per_page
(per_page + 5).times { create(:document, :admin) }
per_page = 3
allow(Document).to receive(:default_per_page).and_return(per_page)
(per_page + 2).times { create(:document, :admin) }
visit admin_site_customization_documents_path
@@ -51,7 +52,7 @@ describe "Documents" do
click_link "Next", exact: false
end
expect(page).to have_selector("#documents .document", count: 5)
expect(page).to have_selector("#documents .document", count: 2)
end
scenario "Create" do