0
0
Fork 0

Add default value to status code

This commit is contained in:
Stormwind 2012-11-17 14:46:53 +01:00
parent 633d5fb7c8
commit a76b08fbb3
2 changed files with 11 additions and 1 deletions

View File

@ -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
#

View File

@ -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