Sha256: acf8381a7afb5e5c7090226be50e0f382467a3542eeae0f31ad532f9811a640d

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

require 'helper'

requires_connection do

  describe EventMachine::HttpRequest do

    it "should perform successful pipelined GETs" do
      EventMachine.run do

        # Mongrel doesn't support pipelined requests - bah!
        conn = EventMachine::HttpRequest.new('http://www.igvita.com/')

        pipe1 = conn.get :keepalive => true
        pipe2 = conn.get :path => '/about/', :keepalive => true

        processed = 0
        stop = proc { EM.stop if processed == 2}

        pipe1.errback { failed(conn) }
        pipe1.callback {
          processed += 1
          pipe1.response_header.status.should == 200
          stop.call
        }

        pipe2.errback { p pipe2; failed(conn) }
        pipe2.callback {
          processed += 1
          pipe2.response_header.status.should == 200
          pipe2.response.should match('biography')
          stop.call
        }

      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-http-request-1.0.0.beta.3 spec/pipelining_spec.rb
em-http-request-1.0.0.beta.2 spec/pipelining_spec.rb
em-http-request-1.0.0.beta.1 spec/pipelining_spec.rb