Sha256: d9e620dc5d26b73ed55e320aec2008979ffb6c8b34b1da94e11dcc6cf984d7e5

Contents?: true

Size: 1.62 KB

Versions: 71

Compression:

Stored size: 1.62 KB

Contents

require 'helper'

describe Gems do
  after do
    Gems.reset
  end

  context "when delegating to a client" do
    before do
      stub_get("/api/v1/gems/rails.yaml").
        to_return(:body => fixture("rails.yaml"))
    end

    it "gets the correct resource" do
      Gems.info('rails')
      expect(a_get("/api/v1/gems/rails.yaml")).to have_been_made
    end

    it "returns the same results as a client" do
      expect(Gems.info('rails')).to eq Gems::Client.new.info('rails')
    end
  end

  describe '.respond_to?' do
    it "takes an optional argument" do
      expect(Gems.respond_to?(:new, true)).to be_true
    end
  end

  describe ".new" do
    it "returns a Gems::Client" do
      expect(Gems.new).to be_a Gems::Client
    end
  end

  describe ".host" do
    it "returns the default host" do
      expect(Gems.host).to eq Gems::Configuration::DEFAULT_HOST
    end
  end

  describe ".host=" do
    it "sets the host" do
      Gems.host = 'http://localhost:3000'
      expect(Gems.host).to eq 'http://localhost:3000'
    end
  end

  describe ".user_agent" do
    it "returns the default user agent" do
      expect(Gems.user_agent).to eq Gems::Configuration::DEFAULT_USER_AGENT
    end
  end

  describe ".user_agent=" do
    it "sets the user agent" do
      Gems.user_agent = 'Custom User Agent'
      expect(Gems.user_agent).to eq 'Custom User Agent'
    end
  end

  describe ".configure" do
    Gems::Configuration::VALID_OPTIONS_KEYS.each do |key|
      it "sets the #{key}" do
        Gems.configure do |config|
          config.send("#{key}=", key)
          expect(Gems.send(key)).to eq key
        end
      end
    end
  end

end

Version data entries

71 entries across 67 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems_spec.rb