Sha256: 3a30331e813793638d887785f213db68f6adcd703f873a251ae0ae74a0b56a60

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

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

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

1 entries across 1 versions & 1 rubygems

Version Path
em-rack-mongrel2-0.1.0 spec/response_spec.rb