Sha256: 31435d9d72a24a993ebad9092889543833bebdb4ec3110eb63d967cb040b26c5

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

require 'helper'

describe Octokit do
  before do
    Octokit.reset!
  end

  after do
    Octokit.reset!
  end

  it "sets defaults" do
    Octokit::Configurable.keys.each do |key|
      expect(Octokit.instance_variable_get(:"@#{key}")).to eq Octokit::Default.send(key)
    end
  end

  describe ".client" do
    it "creates an Octokit::Client" do
      expect(Octokit.client).to be_kind_of Octokit::Client
    end
    it "caches the client when the same options are passed" do
      expect(Octokit.client).to eq Octokit.client
    end
    it "returns a fresh client when options are not the same" do
      client = Octokit.client
      Octokit.access_token = "87614b09dd141c22800f96f11737ade5226d7ba8"
      client_two = Octokit.client
      client_three = Octokit.client
      expect(client).to_not eq client_two
      expect(client_three).to eq client_two
    end
  end

  describe ".configure" do
    Octokit::Configurable.keys.each do |key|
      it "sets the #{key.to_s.gsub('_', ' ')}" do
        Octokit.configure do |config|
          config.send("#{key}=", key)
        end
        expect(Octokit.instance_variable_get(:"@#{key}")).to eq key
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

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