Sha256: f840eb90e9e2d3efe94aa1014cb46b69bf31eac1a5dd0e9cb5d2ea7a0190b4b7

Contents?: true

Size: 772 Bytes

Versions: 4

Compression:

Stored size: 772 Bytes

Contents

module HtHelpers
  def params(str)
    HTTP::Message.parse(str).inject({}) { |r, (k, v)| r[k] = v.first; r }
  end
  def check_query_get(query)
    WEBrick::HTTPUtils.parse_query(@client.get(@srv.u("servlet"), query).header["x-query"][0])
  end
  def check_query_post(query)
    WEBrick::HTTPUtils.parse_query(@client.post(@srv.u("servlet"), query).header["x-query"][0])
  end

  def without_noproxy
    backup = HTTPClient::NO_PROXY_HOSTS.dup
    HTTPClient::NO_PROXY_HOSTS.clear
    yield
  ensure
    HTTPClient::NO_PROXY_HOSTS.replace(backup)
  end

  def silent
    begin
      back, $VERBOSE = $VERBOSE, nil
      yield
    ensure
      $VERBOSE = back
    end
  end
end

RSpec.configure do |config|
  config.include HtHelpers
  config.include HTTPClient::Util
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
glebtv-httpclient-3.3.0 spec/support/ht_helpers.rb
glebtv-httpclient-3.2.8 spec/support/ht_helpers.rb
glebtv-httpclient-3.2.7 spec/support/ht_helpers.rb
glebtv-httpclient-3.2.6 spec/support/ht_helpers.rb