Clear no_proxy in the link preview proxy test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-10-09 00:37:49 +02:00
committed by Rosa Gutierrez
parent a7e9ea53dd
commit 2d4b05a74a
+3 -2
View File
@@ -76,7 +76,8 @@ class Opengraph::FetchTest < ActiveSupport::TestCase
test "#fetch_document connects to the resolved IP even when a proxy is configured" do
url = URI.parse("http://www.example.com/")
saved = ENV.slice("http_proxy", "HTTP_PROXY")
saved = ENV.slice("http_proxy", "HTTP_PROXY", "no_proxy", "NO_PROXY")
%w[ no_proxy NO_PROXY ].each { |k| ENV.delete(k) }
%w[ http_proxy HTTP_PROXY ].each { |k| ENV[k] = "http://proxy.internal:3128" }
WebMock.disable_net_connect! allow: [ url.host ]
@@ -87,7 +88,7 @@ class Opengraph::FetchTest < ActiveSupport::TestCase
@fetch.fetch_document(url, ip: "1.2.3.4")
end
ensure
%w[ http_proxy HTTP_PROXY ].each { |k| ENV.delete(k) }
%w[ http_proxy HTTP_PROXY no_proxy NO_PROXY ].each { |k| ENV.delete(k) }
saved.each { |k, v| ENV[k] = v }
end