Sha256: a29a5d16af7fd95727aeff7f7c7667180cef536244d425891a12c89249109f0d

Contents?: true

Size: 407 Bytes

Versions: 28

Compression:

Stored size: 407 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

28 entries across 28 versions & 2 rubygems

Version Path
em-http-request-1.0.0 spec/stub_server.rb
em-http-request-1.0.0.beta.4 spec/stub_server.rb
em-http-request-1.0.0.beta.3 spec/stub_server.rb
em-http-request-1.0.0.beta.2 spec/stub_server.rb
em-http-request-1.0.0.beta.1 spec/stub_server.rb
em-http-request-0.3.0 spec/stub_server.rb
em-http-request-0.2.15 spec/stub_server.rb
em-http-request-0.2.10 spec/stub_server.rb
em-http-request-0.2.9 spec/stub_server.rb
astro-em-http-request-0.2.10 spec/stub_server.rb
astro-em-http-request-0.2.9 spec/stub_server.rb
astro-em-http-request-0.2.8 spec/stub_server.rb
astro-em-http-request-0.2.7 spec/stub_server.rb
em-http-request-0.2.7 spec/stub_server.rb
astro-em-http-request-0.2.6 spec/stub_server.rb
em-http-request-0.2.6 spec/stub_server.rb
em-http-request-0.2.5 test/stub_server.rb
em-http-request-0.2.4 test/stub_server.rb
em-http-request-0.2.3 test/stub_server.rb
astro-em-http-request-0.2.3 test/stub_server.rb