1
0
Fork 0
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:
Elijah Miller 2009-02-20 09:29:54 +08:00 committed by John Nunemaker
parent f53cc609a1
commit 5c4abbde95
2 changed files with 7 additions and 3 deletions

View file

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

View file

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