Sha256: 36f956c5670ba3d4c1355379e85db0f497870cc8c7989e812b08ccbb7fe9222d

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

module Helpers
  def with_webserver
    require "hayabusa"
    hayabusa = Hayabusa.new(
      doc_root: "#{File.dirname(__FILE__)}/spec_root",
      port: 3005
    )
    hayabusa.start

    begin
      yield(hayabusa)
    ensure
      hayabusa.stop
    end
  end

  def with_http(args = {})
    with_webserver do |hayabusa|
      Http2.new({host: "localhost", port: hayabusa.port, encoding_gzip: false}.merge(args)) do |http|
        yield http
      end
    rescue Http2::Errors::Internalserver => e
      puts "Body of error-response: #{e.response.body}"
      raise e
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
http2-0.0.36 spec/helpers.rb
http2-0.0.35 spec/helpers.rb
http2-0.0.34 spec/helpers.rb
http2-0.0.33 spec/helpers.rb