summaryrefslogtreecommitdiff
path: root/spec/support/api/pagination_shared_examples.rb
blob: 352a6eeec79fb7dcf84dc5bc8687529ff6026227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Specs for paginated resources.
#
# Requires an API request:
#   let(:request) { get api("/projects/#{project.id}/repository/branches", user) }
shared_examples 'a paginated resources' do
  before do
    # Fires the request
    request
  end

  it 'has pagination headers' do
    expect(response.headers).to include('X-Total')
    expect(response.headers).to include('X-Total-Pages')
    expect(response.headers).to include('X-Per-Page')
    expect(response.headers).to include('X-Page')
    expect(response.headers).to include('X-Next-Page')
    expect(response.headers).to include('X-Prev-Page')
    expect(response.headers).to include('Link')
  end
end