Sha256: 9fe5b2c0c7c335a1f8252af00a82d5485d9c91caada10b417a13525767c70316

Contents?: true

Size: 1.3 KB

Versions: 51

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::PageLinks do
  let(:link) {
    "<https://api.github.com/users/wycats/repos?page=4&per_page=20>; rel=\"next\", <https://api.github.com/users/wycats/repos?page=6&per_page=20>; rel=\"last\", <https://api.github.com/users/wycats/repos?page=1&per_page=20>; rel=\"first\", <https://api.github.com/users/wycats/repos?page=2&per_page=20>; rel=\"prev\""
  }
  let(:response_headers)  { { 'Link' => link } }

  let(:first) { "https://api.github.com/users/wycats/repos?page=1&per_page=20" }
  let(:last)  { "https://api.github.com/users/wycats/repos?page=6&per_page=20" }
  let(:prev)  { "https://api.github.com/users/wycats/repos?page=2&per_page=20" }
  let(:nexxt)  { "https://api.github.com/users/wycats/repos?page=4&per_page=20" }

  context 'build page links instance' do

    it 'parses first link successfully' do
      Github::PageLinks.new(response_headers).first.should eql first
    end

    it 'parses last link successfully' do
      Github::PageLinks.new(response_headers).last.should eql last
    end

    it 'parses next link successfully' do
      Github::PageLinks.new(response_headers).next.should eql nexxt
    end

    it 'parses prev link successfully' do
      Github::PageLinks.new(response_headers).prev.should eql prev
    end
  end

end # Github::PageLinks

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/page_links_spec.rb
github_api-0.12.2 spec/github/page_links_spec.rb
github_api-0.12.1 spec/github/page_links_spec.rb
github_api-0.12.0 spec/github/page_links_spec.rb
github_api-0.11.3 spec/github/page_links_spec.rb
github_api-0.11.2 spec/github/page_links_spec.rb
github_api-0.11.1 spec/github/page_links_spec.rb
github_api-0.11.0 spec/github/page_links_spec.rb
github_api-0.10.2 spec/github/page_links_spec.rb
github_api-0.10.1 spec/github/page_links_spec.rb
github_api-0.10.0 spec/github/page_links_spec.rb
github_api-0.9.7 spec/github/page_links_spec.rb
github_api-0.9.6 spec/github/page_links_spec.rb
github_api-0.9.5 spec/github/page_links_spec.rb
github_api-0.9.4 spec/github/page_links_spec.rb
github_api-0.9.3 spec/github/page_links_spec.rb
github_api-0.9.2 spec/github/page_links_spec.rb
github_api-0.9.1 spec/github/page_links_spec.rb
github_api-0.9.0 spec/github/page_links_spec.rb
github_api-0.8.11 spec/github/page_links_spec.rb