diff options
-rw-r--r-- | lib/zero/response.rb | 7 | ||||
-rw-r--r-- | spec/unit/response/response_spec.rb | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/zero/response.rb b/lib/zero/response.rb index 3c54c54..26e03fb 100644 --- a/lib/zero/response.rb +++ b/lib/zero/response.rb @@ -6,6 +6,13 @@ module Zero attr_reader :status attr_accessor :header, :body + # Construtor + # Sets default status code to 200. + # + def initialize + @status = 200 + end + # Sets the status. # Also converts every input directly to an integer # diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb index 28ee6db..a40b688 100644 --- a/spec/unit/response/response_spec.rb +++ b/spec/unit/response/response_spec.rb @@ -19,11 +19,14 @@ end describe Zero::Response, '#status' do it "must return the status always as an integer" do - subject.status = "foobar" subject.status.should eq(0) subject.status = 240.5 subject.status.should eq(240) end + + it "must return 200, if no status code was set" do + subject.status.should eq(200) + end end
\ No newline at end of file |