How to set up a different page size for production and testing for Kaminari

I am running some rspec unit tests, including getting the data back through kaminari paging, but the default page size for our application is 20, while 2 will work fine for the test.

How to set a different configuration for the default Kaminari page size for the test, or how to set it up during the installation of rspec for the test?

+4
source share
2 answers

In your model, you can override the default per_page value:

class Something < ActiveRecord::Base paginates_per Rails.env.test? ? 2 : 20 end 
+6
source

not to do. You should check the data as close as possible to the production environment.

-4
source

All Articles