Add default value to status code
This commit is contained in:
parent
633d5fb7c8
commit
a76b08fbb3
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue