Sha256: 16af1aaa131a3d82e2f31e3be4a4036f34f30a16bf7143ff94f557a4d5533571

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe Gitlab::PageLinks do
  before do
    @page_links = Gitlab::PageLinks.new('Link' => "<http://example.com/api/v3/projects?page=1&per_page=5>; rel=\"first\", <http://example.com/api/v3/projects?page=20&per_page=5>; rel=\"last\", <http://example.com/api/v3/projects?page=7&per_page=5>; rel=\"prev\", <http://example.com/api/v3/projects?page=9&per_page=5>; rel=\"next\"")
  end

  context '.extract_links' do
    it 'extracts link header appropriately' do
      expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5'
      expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5'
      expect(@page_links.next).to eql 'http://example.com/api/v3/projects?page=9&per_page=5'
      expect(@page_links.prev).to eql 'http://example.com/api/v3/projects?page=7&per_page=5'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-4.4.0 spec/gitlab/page_links_spec.rb
gitlab-4.3.0 spec/gitlab/page_links_spec.rb