mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Forcing code to a Fixnum/Integer.
Signed-off-by: John Nunemaker <nunemaker@gmail.com>
This commit is contained in:
parent
f53cc609a1
commit
5c4abbde95
2 changed files with 7 additions and 3 deletions
|
@ -6,7 +6,7 @@ module HTTParty
|
|||
def initialize(delegate, body, code, headers={})
|
||||
@delegate = delegate
|
||||
@body = body
|
||||
@code = code
|
||||
@code = code.to_i
|
||||
@headers = headers
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ describe HTTParty::Response do
|
|||
before do
|
||||
@response_object = {'foo' => 'bar'}
|
||||
@body = "{foo:'bar'}"
|
||||
@code = 200
|
||||
@code = '200'
|
||||
@response = HTTParty::Response.new(@response_object, @body, @code)
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,11 @@ describe HTTParty::Response do
|
|||
end
|
||||
|
||||
it "should set code" do
|
||||
@response.code.should == @code
|
||||
@response.code.should.to_s == @code
|
||||
end
|
||||
|
||||
it "should set code as a Fixnum" do
|
||||
@response.code.should be_an_instance_of(Fixnum)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue