rubocop indications

This commit is contained in:
HoneyryderChuck 2018-03-23 14:48:10 +00:00
parent 2813ff9efb
commit e36c6347bf
7 changed files with 8 additions and 10 deletions

View File

@ -221,7 +221,7 @@ module HTTPX
def emit_error(e)
response = ErrorResponse.new(e, 0, @options)
@pending.each do |request, _|
@pending.each do |request, _| # rubocop:disable Performance/HashEachMethods
emit(:response, request, response)
end
end

View File

@ -6,7 +6,6 @@ module HTTPX
TimeoutError = Class.new(Error)
HTTPError = Class.new(Error) do
attr_reader :status
def initialize(status)

View File

@ -222,7 +222,7 @@ module HTTPX
@error = error
@retries = retries
@options = Options.new(options)
log { "#{error.class}: #{error}"}
log { "#{error.class}: #{error}" }
log { caller.join("\n") }
end

View File

@ -25,7 +25,7 @@ class HTTPTest < Minitest::Test
private
def origin(orig=httpbin)
def origin(orig = httpbin)
"http://#{orig}"
end
end

View File

@ -23,7 +23,7 @@ class HTTPSTest < Minitest::Test
private
def origin(orig=httpbin)
def origin(orig = httpbin)
"https://#{orig}"
end
end

View File

@ -32,7 +32,7 @@ class ResponseTest < Minitest::Test
r4 = Response.new(request, 500, "2.0", {})
assert_raises(HTTPX::HTTPError) { r4.raise_for_status }
end
def test_response_body_to_s
opts = { threshold_size: 1024 }
body1 = Response::Body.new(Response.new(request, 200, "2.0", {}), opts)

View File

@ -1,8 +1,7 @@
module Requests
module Errors
def test_connection_refused
unavailable_host = URI(origin('localhost'))
unavailable_host = URI(origin("localhost"))
unavailable_host.port = next_available_port
response = HTTPX.get(unavailable_host.to_s)
assert response.is_a?(HTTPX::ErrorResponse), "response should contain errors"
@ -12,10 +11,10 @@ module Requests
private
def next_available_port
server = TCPServer.new('localhost', 0)
server = TCPServer.new("localhost", 0)
server.addr[1]
ensure
server.close
end
end
end
end