diff --git a/test/open-uri/test_ftp.rb b/test/open-uri/test_ftp.rb index 9698ff2777ed89..0b3bafb9e0341a 100644 --- a/test/open-uri/test_ftp.rb +++ b/test/open-uri/test_ftp.rb @@ -8,10 +8,10 @@ def with_env(h) begin old = {} h.each_key {|k| old[k] = ENV[k] } - h.each {|k, v| ENV[k] = v } + ENV.update(h) yield ensure - h.each_key {|k| ENV[k] = old[k] } + ENV.update(old) end end diff --git a/test/open-uri/test_proxy.rb b/test/open-uri/test_proxy.rb index a36a63f21f2c80..0cc711a0f3cee3 100644 --- a/test/open-uri/test_proxy.rb +++ b/test/open-uri/test_proxy.rb @@ -11,10 +11,10 @@ def with_env(h) begin old = {} h.each_key {|k| old[k] = ENV[k] } - h.each {|k, v| ENV[k] = v } + ENV.update(h) yield ensure - h.each_key {|k| ENV[k] = old[k] } + ENV.update(old) end end