Sha256: ae8d1622462481597bf29c881368a14eb88c1bc48ba0a51ea1bac4b799863c1e

Contents?: true

Size: 1.35 KB

Versions: 68

Compression:

Stored size: 1.35 KB

Contents

require 'helper'

describe Gems::Request do
  after do
    Gems.reset
  end

  describe "#get with redirect" do
    before do
      # request_uri = URI.parse("https://rubygems.org/api/v1/dependencies?gems=rails,thor")
      response_body = %q(<html>\r\n<head><title>302 Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>302 Found</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n)
      response_code = "302"
      response_location = "https://bundler.rubygems.org/api/v1/dependencies?gems=rails,thor"

      stub_get("/api/v1/dependencies").
        with(:query => {"gems" => "rails,thor"}).
        to_return(:body => response_body, :status => 302, :headers => {:location => response_location})
      stub_request(:get, "https://bundler.rubygems.org/api/v1/dependencies").
        with(:query => {"gems" => "rails,thor"}).
         to_return(:body => fixture('dependencies'), :status => 200, :headers => {})

    end
    it "returns an array of hashes for all versions of given gems" do
      dependencies = Gems.dependencies 'rails', 'thor'
      expect(a_get("/api/v1/dependencies").with(:query => {"gems" => "rails,thor"})).to have_been_made
      expect(a_get("https://bundler.rubygems.org/api/v1/dependencies").with(:query => {"gems" => "rails,thor"})).to have_been_made
      expect(dependencies.first[:number]).to eq "3.0.9"
    end
  end

end

Version data entries

68 entries across 64 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/request_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/gems-0.8.3/spec/gems/request_spec.rb