debian-mirror-gitlab/spec/lib/api/helpers/pagination_spec.rb
2020-03-09 13:42:32 +05:30

18 lines
584 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe API::Helpers::Pagination do
subject { Class.new.include(described_class).new }
let(:paginator) { double('paginator') }
let(:relation) { double('relation') }
let(:expected_result) { double('expected result') }
it 'delegates to OffsetPagination' do
expect(Gitlab::Pagination::OffsetPagination).to receive(:new).with(subject).and_return(paginator)
expect(paginator).to receive(:paginate).with(relation).and_return(expected_result)
expect(subject.paginate(relation)).to eq(expected_result)
end
end