spec/reel/connection_spec.rb in reel-0.5.0.pre vs spec/reel/connection_spec.rb in reel-0.5.0
- old
+ new
@@ -95,11 +95,11 @@
crlf = "\r\n"
fixture = "5#{crlf}Hello#{crlf}5#{crlf}World#{crlf}0#{crlf*2}"
response[(response.length - fixture.length)..-1].should eq fixture
end
-
+
it "with keep-alive" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)
client << ExampleRequest.new.to_s
request = connection.request
@@ -139,11 +139,11 @@
end
connection.close
end
end
end
-
+
it "reset the request after a response is sent" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)
example_request = ExampleRequest.new(:get, "/", "1.1", {'Connection' => 'close'})
client << example_request
@@ -337,9 +337,19 @@
while chunk = request.body.readpartial(8)
rebuilt << chunk
end
request.should be_finished_reading
rebuilt.should == ["I'm data", " you can", " stream!"]
+ end
+ end
+ end
+
+ context "#respond" do
+ it "accepts Fixnum as status" do
+ with_socket_pair do |client, peer|
+ connection = Reel::Connection.new(peer)
+
+ connection.respond 200, {}, []
end
end
end
context "#each" do