开发者

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

开发者 https://www.devze.com 2023-04-08 18:12 出处:网络
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.

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?


In your model you can override the default per_page:

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


Don't. You are supposed to test the data as similar to the production environment as possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消