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
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/webmock-3.18.1/spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.18.1 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.18.0 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.15.2 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.16.2 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.16.1 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.15.1 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.17.1 spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.17.0 spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb
webmock-3.14.0 spec/acceptance/manticore/manticore_spec_helper.rb