summaryrefslogtreecommitdiff
path: root/spec/lib/api/helpers/pagination_spec.rb
blob: 796c753d6c4e4317b379ee501c90e2f1cd8d3aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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