Skip to content

Commit b3b6148

Browse files
committed
test paginate_array behaviour
1 parent a1b56cf commit b3b6148

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

spec/api-pagination_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe ApiPagination do
4+
let(:collection) { (1..100).to_a }
5+
let(:paginate_array_options) { { total_count: 1000 } }
6+
7+
context 'Using kaminari' do
8+
before do
9+
ApiPagination.config.paginator = :kaminari
10+
end
11+
12+
after do
13+
ApiPagination.config.paginator = ENV['PAGINATOR'].to_sym
14+
end
15+
16+
it 'should accept paginate_array_options option' do
17+
expect(Kaminari).to receive(:paginate_array)
18+
.with(collection, paginate_array_options)
19+
.and_call_original
20+
21+
ApiPagination.paginate(
22+
collection,
23+
{
24+
per_page: 30,
25+
paginate_array_options: paginate_array_options
26+
}
27+
)
28+
end
29+
end
30+
end

0 commit comments

Comments
 (0)