Sha256: f4648fdece6a33424f1faac10440ba7ea76ae5f6553f00ed4e9a34caa8137726

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'helper'

describe Octokit::Client do

  describe ".rate_limit" do
    it "makes a response if there is no last response" do
      client = Octokit::Client.new
      VCR.use_cassette 'rate_limit' do
        rate = client.rate_limit

        expect(rate.limit).to be_kind_of Fixnum
        expect(rate.remaining).to be_kind_of Fixnum
      end
    end # .rate_limit
    it "checks the rate limit from the last response" do
      client = Octokit::Client.new
      VCR.use_cassette 'root' do
        client.get('/')
        VCR.use_cassette 'rate_limit' do
          rate = client.rate_limit
          expect(rate.limit).to be_kind_of Fixnum
          expect(rate.remaining).to be_kind_of Fixnum
        end
      end
    end
  end

  describe ".rate_limit!" do
    it "makes a web request to check the rate limit" do
      client = Octokit::Client.new
      VCR.use_cassette 'rate_limit' do
        rate = client.rate_limit!

        expect(rate.limit).to be_kind_of Fixnum
        expect(rate.remaining).to be_kind_of Fixnum
      end
    end
  end # .rate_limit!

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octokit-2.0.0.pre spec/octokit/client/rate_limit_spec.rb