Clear no_proxy in the link preview proxy test

(cherry picked from commit 2d4b05a74a)
This commit is contained in:
Rosa Gutierrez authored and Jeremy Daer committed 2026-10-17 01:11:38 -07:00
1 parent a1dd6e1d8a
commit 9474e70f5a
1 file changed
+3 -2
+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