Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you configure a different page size for production and test for Kaminari

I'm running some rspec unit tests involving getting data back through kaminari paging, but the default page size for our application is 20, whereas 2 would work fine for test.

How do a set a different configuration for the default kaminari page size for test, or how do I set it up during the rspec setup for the test?

like image 638
Steve Mitcham Avatar asked Nov 25 '22 08:11

Steve Mitcham


1 Answers

In your model you can override the default per_page:

class Something < ActiveRecord::Base
  paginates_per Rails.env.test? ? 2 : 20
end
like image 173
James Avatar answered Dec 19 '22 02:12

James