Sha256: 940ba886810e4dfdef243a83586120a7a9699b84c95e47b6556f1c75439077f0

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

require 'rest-more/test'

describe RC::Github do
  after do
    WebMock.reset!
  end

  would 'get all' do
    link = '</users/godfat/repos?type=o&per_page=100&page=3>; rel="last"'
    headers = {'Link' => link}
    stub_request(:get,
      'https://api.github.com/users/godfat/repos?type=o&per_page=100').
      to_return(:body => [0], :headers => headers).times(2)
    stub_request(:get,
      'https://api.github.com/users/godfat/repos?type=o&per_page=100&page=2').
      to_return(:body => [1], :headers => headers).times(2)
    stub_request(:get,
      'https://api.github.com/users/godfat/repos?type=o&per_page=100&page=3').
      to_return(:body => [2], :headers => headers).times(2)

    args = ['users/godfat/repos', {:type => 'o'}]
    exps = [0, 1, 2]
    g = RC::Github.new
    g.all(*args) do |res|
      res.should.eq exps
      g.all(*args).should.eq exps
    end
    g.wait
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rest-more-3.3.4 test/github/test_github.rb
rest-more-3.3.3 test/github/test_github.rb
rest-more-3.3.2 test/github/test_github.rb
rest-more-3.3.1 test/github/test_github.rb
rest-more-3.3.0 test/github/test_github.rb