rubocop changes

This commit is contained in:
HoneyryderChuck 2022-11-01 22:41:42 +00:00
parent caa5bb43c7
commit 3d4fe177e3
4 changed files with 5 additions and 5 deletions

View File

@ -115,7 +115,7 @@ module HTTPX
elsif value.respond_to?(:each)
digest = OpenSSL::Digest.new(@algorithm)
mb_buffer = value.each.each_with_object("".b) do |chunk, buffer|
mb_buffer = value.each.with_object("".b) do |chunk, buffer|
buffer << chunk
break if buffer.bytesize >= 1024 * 1024
end

View File

@ -60,7 +60,7 @@ module ResponseHelpers
case expectation
when Regexp
assert response.error.message =~ expectation,
"expected to match \/#{expectation}\/ in \"#{response.error.message}\""
"expected to match /#{expectation}/ in \"#{response.error.message}\""
when String
assert response.error.message.include?(expectation),
"expected \"#{response.error.message}\" to include \"#{expectation}\""

View File

@ -108,7 +108,7 @@ module Requests
# Test special cases
special_jar = HTTPX::Plugins::Cookies::Jar.new
special_jar.parse(%(a="b"; Path=/, c=d; Path=/, e="f\\\"; \\\"g"))
special_jar.parse(%(a="b"; Path=/, c=d; Path=/, e="f\\"; \\"g"))
cookies = special_jar[jar_cookies_uri]
assert(cookies.one? { |cookie| cookie.name == "a" && cookie.value == "b" })
assert(cookies.one? { |cookie| cookie.name == "c" && cookie.value == "d" })
@ -187,7 +187,7 @@ module Requests
# quoting funny characters
sch_cookie = HTTPX::Plugins::Cookies::Cookie.new("Bar", "value\"4")
assert sch_cookie.cookie_value == %(Bar="value\\\"4")
assert sch_cookie.cookie_value == %(Bar="value\\"4")
# sorting
c1 = HTTPX::Plugins::Cookies::Cookie.new("a", "b")

View File

@ -30,7 +30,7 @@ module Requests
session = HTTPX.plugin(:stream)
response = session.get(build_uri("/stream/3"), stream: true)
lines = response.each_line.each_with_index.map do |line, idx|
lines = response.each_line.with_index.map do |line, idx|
assert !line.end_with?("\n")
data = JSON.parse(line)
assert data["id"] == idx