aboutsummaryrefslogtreecommitdiff
path: root/spec/unit/response/response_spec.rb
blob: 28ee6db4d02ae5b162272b0f8914234053588164 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'spec_helper'

describe Zero::Response, '#finish' do
  subject { Zero::Response.new() }
  
  it "returns an array within status header and body" do
    subject.status = 200
    subject.header = {}
    subject.body   = []

    value = subject.to_a

    value.should be_an_instance_of(Array)
    value[0].should eq(200) # Status code
    value[1].should eq({})  # Headers
    value[2].should eq([])  # Body
  end
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
end