diff --git a/lib/warbler/web_server.rb b/lib/warbler/web_server.rb index 5dce7078..d2ac03fa 100644 --- a/lib/warbler/web_server.rb +++ b/lib/warbler/web_server.rb @@ -20,7 +20,7 @@ def local_path FileUtils.mkdir_p File.dirname(cached_path) #:nocov: require 'open-uri' #:nocov: begin - open(download_url) do |stream| #:nocov: + URI.open(download_url) do |stream| #:nocov: File.open(cached_path, "wb") do |f| #:nocov: while buf = stream.read(4096) #:nocov: f << buf #:nocov: diff --git a/spec/warbler/web_server_spec.rb b/spec/warbler/web_server_spec.rb index 8da8c1eb..7cfcd3b4 100644 --- a/spec/warbler/web_server_spec.rb +++ b/spec/warbler/web_server_spec.rb @@ -8,9 +8,9 @@ def self.reset_local_repository describe Warbler::WebServer::Artifact do - @@_env = ENV.to_h - - after(:all) { ENV.clear; ENV.update @@_env } + before(:all) do + @_env = ENV.to_h + end before do Warbler::WebServer::Artifact.reset_local_repository @@ -18,6 +18,8 @@ def self.reset_local_repository after(:all) do Warbler::WebServer::Artifact.reset_local_repository + ENV.clear + ENV.update @_env end let(:sample_artifact) do