Sha256: 064f86d0de5f139d81eb0354fae5576ca7f31652a82a218b436aa0fee0727335

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 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
          expect(rate.resets_at).to be_kind_of Time
          expect(rate.resets_in).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
        expect(rate.resets_at).to be_kind_of Time
        expect(rate.resets_in).to be_kind_of Fixnum
      end
    end
  end # .rate_limit!

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
octokit-2.3.0 spec/octokit/client/rate_limit_spec.rb
octokit-2.2.0 spec/octokit/client/rate_limit_spec.rb
octokit-2.1.2 spec/octokit/client/rate_limit_spec.rb
octokit-2.1.1 spec/octokit/client/rate_limit_spec.rb
octokit-2.1.0 spec/octokit/client/rate_limit_spec.rb
octokit-2.0.0 spec/octokit/client/rate_limit_spec.rb
octokit-2.0.0.rc4 spec/octokit/client/rate_limit_spec.rb
octokit-2.0.0.rc3 spec/octokit/client/rate_limit_spec.rb
octokit-2.0.0.rc2 spec/octokit/client/rate_limit_spec.rb
octokit-2.0.0.rc1 spec/octokit/client/rate_limit_spec.rb