diff --git a/script/test-redirections b/script/test-redirections index 23a84d8..4bfc358 100755 --- a/script/test-redirections +++ b/script/test-redirections @@ -11,7 +11,7 @@ def start_server(port, location) client = server.accept # Append a hit in the file - File.open('/tmp/bad-redirection.log', 'a') do |file| + File.open("/tmp/bad-redirection#{ENV["RUBY_VERSION"]}.log", 'a') do |file| file.print("HIT #{port} ") end diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index 74cbed8..50cb87a 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -664,11 +664,13 @@ end context "Protocol redirections" do - let(:log_file) { "/tmp/bad-redirection.log" } + let(:log_file) { "/tmp/bad-redirection#{ENV["RUBY_VERSION"]}.log" } + before do + File.open(log_file, "w") # truncate log file + end it "it follows ftp if requested" do # Make a real request to a local server started with /script/test-redirections - File.open(log_file, "w") # truncate log file Typhoeus.get( "http://localhost:9988", GitHubPages::HealthCheck.typhoeus_options.merge(:redir_protocols => %i[http https ftp]) @@ -680,7 +682,6 @@ it "it does not follow anything other than http/https by default" do # Make a real request to a local server started with /script/test-redirections - File.open(log_file, "w") # truncate log file Typhoeus.get( "http://localhost:9988", GitHubPages::HealthCheck.typhoeus_options