Sha256: 8df93598a872176cd00e9416e25d6f9b0d03ef71c9009bd889d8000ec1d4c507

Contents?: true

Size: 822 Bytes

Versions: 105

Compression:

Stored size: 822 Bytes

Contents

module ManticoreSpecHelper
  def http_request(method, uri, options = {})
    client = Manticore::Client.new

    if basic_auth = options[:basic_auth]
      options = options.merge(auth: {user: basic_auth[0], pass: basic_auth[1]})
    end

    response = client.http(method, uri, options)
    OpenStruct.new({
      body: response.body || '',
      headers: WebMock::Util::Headers.normalize_headers(join_array_values(response.headers)),
      status: response.code.to_s
    })
  end

  def join_array_values(hash)
    hash.reduce({}) do |h, (k,v)|
      v = v.join(', ') if v.is_a?(Array)
      h.merge(k => v)
    end
  end

  def client_timeout_exception_class
    Manticore::ConnectTimeout
  end

  def connection_refused_exception_class
    Manticore::SocketException
  end

  def http_library
    :manticore
  end
end

Version data entries

105 entries across 99 versions & 8 rubygems

Version Path
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.13.0 spec/acceptance/manticore/manticore_spec_helper.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec_helper.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.12.2 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.12.1 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.12.0 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.11.3 spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/webmock-3.11.2/spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.11.2 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.11.1 spec/acceptance/manticore/manticore_spec_helper.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec_helper.rb