Sha256: 14cd1173464f11a8df297a1b07d4c30286ac43f3a3d3b9575c41174f0971f563

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 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|
        begin
          yield http
        rescue Http2::Errors::Internalserver => e
          puts "Body of error-response: #{e.response.body}"
          raise e
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
http2-0.0.32 spec/helpers.rb
http2-0.0.31 spec/helpers.rb
http2-0.0.30 spec/helpers.rb