Sha256: e44caa4da569d573bdebcd9a26c7a051270236bb7cc1153e2e389316528f92c4

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Mongrel2::Response do
  before(:each) do
    @req = double()
    @resp = double()
    @response = Mongrel2::Response.new(@resp)
  end

  it 'should build the HTTP request format' do
    @req.should_receive(:uuid) { 'UUID' }
    @req.should_receive(:conn_id) { 'CONN_ID' }

    httpreq = "UUID 7:CONN_ID, HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\nBoo!"
    @resp.should_receive(:send_msg).with(httpreq)

    @response.send_http(@req, 'Boo!', 200, {})
  end

  it 'should send a blank response to close the response' do
    @req.should_receive(:uuid) { 'UUID' }
    @req.should_receive(:conn_id) { 'CONN_ID' }

    httpreq = 'UUID 7:CONN_ID, '
    @resp.should_receive(:send_msg).with(httpreq)

    @response.close(@req)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-rack-mongrel2-0.2.1 spec/response_spec.rb
em-rack-mongrel2-0.2.0 spec/response_spec.rb