2019-09-30 08:06:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-10 09:01:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe PaginationHelper do
|
2017-08-10 09:01:38 -04:00
|
|
|
describe '#paginate_collection' do
|
|
|
|
let(:collection) { User.all.page(1) }
|
|
|
|
|
|
|
|
it 'paginates a collection without using a COUNT' do
|
|
|
|
without_count = collection.without_count
|
|
|
|
|
|
|
|
expect(helper).to receive(:paginate_without_count)
|
|
|
|
.with(without_count)
|
|
|
|
.and_call_original
|
|
|
|
|
|
|
|
helper.paginate_collection(without_count)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'paginates a collection using a COUNT' do
|
|
|
|
expect(helper).to receive(:paginate_with_count).and_call_original
|
|
|
|
|
|
|
|
helper.paginate_collection(collection)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|