Sha256: a9f68bc397bdc54472dde1518af4e26c7754550a0db293b8a871163e1e79b7b5

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 Bytes

Contents

require 'spec_helper'

describe Reel::Response do
  it "streams enumerables" do
    with_socket_pair do |client, connection|
      client << ExampleRequest.new.to_s
      request = connection.request

      connection.respond Reel::Response.new(:ok, ["Hello", "World"])
      connection.close

      response = client.read(4096)
      crlf = Reel::Response::Writer::CRLF
      fixture = "5#{crlf}Hello#{crlf}5#{crlf}World#{crlf}0#{crlf*2}"
      response[(response.length - fixture.length)..-1].should eq fixture
    end
  end

  it "canonicalizes response headers" do
    with_socket_pair do |client, connection|
      client << ExampleRequest.new.to_s
      request = connection.request

      connection.respond Reel::Response.new(:ok, {"content-type" => "application/json"}, "['mmmkay']")
      connection.close

      response = client.read(4096)
      expect(response["Content-Type: application/json"]).to_not be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reel-0.4.0.pre7 spec/reel/response_spec.rb
reel-0.4.0.pre6 spec/reel/response_spec.rb