File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 77 schema : 'support/active_record/schema'
88)
99
10- describe 'using kaminari with active_record ' do
10+ shared_examples 'produces_correct_sql ' do
1111 let ( :collection ) { Foo . all }
1212 let ( :per_page ) { 5 }
1313
1414 it 'produces correct sql for first page' do
1515 paginated_sql = ApiPagination . paginate ( collection , per_page : per_page )
1616 . to_sql
17-
1817 expect ( paginated_sql ) . to eql ( Foo . limit ( per_page ) . offset ( 0 ) . to_sql )
1918 end
19+ end
20+
21+ if ApiPagination . config . paginator == :kaminari
22+ describe 'pagination with kaminari' do
23+ before do
24+ ApiPagination . config . paginator = :kaminari
25+ end
26+
27+ include_examples 'produces_correct_sql'
28+ end
29+ end
30+
31+ if ApiPagination . config . paginator == :will_paginate
32+ require 'will_paginate/active_record'
33+
34+ describe 'pagination with will_paginate' do
35+ before do
36+ ApiPagination . config . paginator = :will_paginate
37+ end
38+
39+ include_examples 'produces_correct_sql'
40+ end
2041end
You can’t perform that action at this time.
0 commit comments