Sha256: 29faba1c63f01b75893a6ee327177c7ed3f7c4ddb57340b59f58e8483765ae31

Contents?: true

Size: 429 Bytes

Versions: 4

Compression:

Stored size: 429 Bytes

Contents

class StubServer
  module Server
    def receive_data(data)
      send_data @response
      close_connection_after_writing
    end

    def response=(response)
      @response = response
    end
  end

  def initialize(response, port=8081)
    @sig = EventMachine::start_server("127.0.0.1", port, Server) { |s|
      s.response = response
    }
  end

  def stop
    EventMachine.stop_server @sig
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
em-http-request-0.2.14 spec/stub_server.rb
em-http-request-0.2.13 spec/stub_server.rb
em-http-request-0.2.12 spec/stub_server.rb
em-http-request-0.2.11 spec/stub_server.rb