Permalink
Browse files

Make sure response_code is an integer.

  • Loading branch information...
1 parent 738f5bb commit da08befbb6797f2fe56d47b3ceaed8f668961914 @i0rek i0rek committed Dec 4, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/typhoeus/response/informations.rb
  2. +4 −4 spec/typhoeus/response/informations_spec.rb
@@ -46,7 +46,7 @@ def response_headers
#
# @return [ Integer ] The response_code.
def response_code
- options[:response_code] || options[:code]
+ (options[:response_code] || options[:code]).to_i
end
alias :code :response_code
@@ -40,18 +40,18 @@
describe "#response_code" do
context "when response_code" do
- let(:options) { { :response_code => "code" } }
+ let(:options) { { :response_code => "200" } }
it "returns response_code from options" do
- expect(response.response_code).to eq("code")
+ expect(response.response_code).to eq(200)
end
end
context "when code" do
- let(:options) { { :code => "code" } }
+ let(:options) { { :code => "200" } }
it "returns code from options" do
- expect(response.code).to eq("code")
+ expect(response.code).to eq(200)
end
end
end

0 comments on commit da08bef

Please sign in to comment.