diff options
author | Stormwind <stormwind@stormwinds-page.de> | 2012-11-23 20:05:58 +0100 |
---|---|---|
committer | Stormwind <stormwind@stormwinds-page.de> | 2012-11-23 20:05:58 +0100 |
commit | fea8ac2bbd04fd4abea929fef1b7e8ac305b4ca1 (patch) | |
tree | 76a0b11d30d8a60621ab057a999f188586276cfc /spec/unit | |
parent | 16eef08688a50b31239cd67080439e8e6dead4a2 (diff) |
Sets the Content-Type in to_a unless it is already set before
The default value is 'text/html'.
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/response/response_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 58b8d07..18612ce 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -14,7 +14,7 @@ describe Zero::Response do value.should be_an_instance_of(Array) value[0].should eq(200) # Status code - value[1].should eq({"Content-Length" => 0}) # Headers + value[1].should be_an_instance_of(Hash) # Headers value[2].should eq([]) # Body end @@ -22,7 +22,7 @@ describe Zero::Response do subject.body = ['foobar'] value = subject.to_a - value[1].should eq({'Content-Length' => 6}) # Headers + value[1]['Content-Length'].should eq(6) # Headers end it "does not fix the Content-Length, if it's already set" do @@ -30,7 +30,20 @@ describe Zero::Response do subject.header = {'Content-Length' => 3} value = subject.to_a - value[1].should eq({'Content-Length' => 3}) # Headers + value[1]['Content-Length'].should eq(3) # Headers + end + + it "returns the Content-Type in the header" do + subject.header = {'Content-Type' => 'application/json'} + value = subject.to_a + + value[1]['Content-Type'].should eq('application/json') # Headers + end + + it "returns as default 'text/html' as Content-Type" do + value = subject.to_a + + value[1]['Content-Type'].should eq('text/html') # Headers end end |