aboutsummaryrefslogtreecommitdiff
path: root/spec/unit/response/response_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/response/response_spec.rb')
-rw-r--r--spec/unit/response/response_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb
index c314567..e58b0d0 100644
--- a/spec/unit/response/response_spec.rb
+++ b/spec/unit/response/response_spec.rb
@@ -1,9 +1,10 @@
+# encoding: UTF-8
require 'spec_helper'
describe Zero::Response do
subject { Zero::Response.new() }
- describe '#finish' do
+ describe '#to_a' do
it "returns an array within status header and body" do
subject.status = 200
subject.header = {}
@@ -16,6 +17,9 @@ describe Zero::Response do
value[1].should eq({}) # Headers
value[2].should eq([]) # Body
end
+
+ it "returns the content length in the header" do
+ end
end
describe '#status' do
@@ -44,4 +48,26 @@ describe Zero::Response do
end
end
+ describe '#content_length' do
+ it "sets the content_length to 0, if there is no content" do
+ subject.content_length
+
+ subject.header['Content-Length'].should eq(0)
+ end
+
+ it "sets the content_length to the size of the message body" do
+ subject.body = ['foo', 'bar']
+ subject.content_length
+
+ subject.header['Content-Length'].should eq(6)
+ end
+
+ it "sets the content_length to the bytesize of the message body" do
+ subject.body = ['föö', 'bär']
+ subject.content_length
+
+ subject.header['Content-Length'].should eq(9)
+ end
+ end
+
end \ No newline at end of file