Skip to content

Commit

Permalink
again?
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannchaudet committed Sep 13, 2024
1 parent b315332 commit b691bf5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions spec/github_pages_health_check/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -683,19 +683,17 @@ def initialize(location, out)
@out = out
end

def port()
@port
end
attr_reader :port

def start()
def start
loop do
client = @server.accept

# Log
@out << "HIT #{@port}"

# Continue with HTTP redirect
if @location != 'STOP'
if @location != "STOP"
request = client.gets
if request
response = <<~RESPONSE
Expand All @@ -708,6 +706,10 @@ def start()
client.close
end
end

def stop
@server.close
end
end

@servers = []
Expand All @@ -718,7 +720,11 @@ def start()
end
end

it "it does not follow anything other than http/https by default" do
after do
@servers.each(&:stop)
end

it "it does not follow anything other than http/https by default", :retry do
Typhoeus.get(
"http://localhost:#{@servers[1].port}",
GitHubPages::HealthCheck.typhoeus_options
Expand All @@ -727,7 +733,7 @@ def start()
expect(@out).to_not include("HIT #{@servers[0].port}")
end

it "it follows ftp if requested (negative test)" do
it "it follows ftp if requested (negative test)", :retry do
Typhoeus.get(
"http://localhost:#{@servers[1].port}",
GitHubPages::HealthCheck.typhoeus_options.merge(:redir_protocols => %i[http https ftp])
Expand Down

0 comments on commit b691bf5

Please sign in to comment.