From 3ff56d815ab38bf169f2e5394b97c35616e3d559 Mon Sep 17 00:00:00 2001 From: Stormwind Date: Sun, 18 Nov 2012 16:09:41 +0100 Subject: Add default value for the body --- lib/zero/response.rb | 3 ++- spec/unit/response/response_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/zero/response.rb b/lib/zero/response.rb index 2966fa2..0981261 100644 --- a/lib/zero/response.rb +++ b/lib/zero/response.rb @@ -12,6 +12,7 @@ module Zero def initialize @status = 200 @header = {} + @body = [] end # Sets the status. @@ -27,7 +28,7 @@ module Zero # [status, header, body] # to be usable by any webserver # - # @return Array + # @return [Array] # def to_a() [@status, @header, @body] diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 0f47680..bced8c1 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -36,3 +36,9 @@ describe Zero::Response, '#header' do subject.header.should eq({}) end end + +describe Zero::Response, '#body' do + it "must return an empty array, if no body was set" do + subject.body.should eq([]) + end +end -- cgit v1.2.3-70-g09d2