global

def should_be_on(server_index, path = "/host", scheme = "http")

def should_be_on(server_index, path = "/host", scheme = "http")
  # Check that we are on /host on the given server
  s = @servers[server_index]
  expect(@session).to have_current_path("#{scheme}://#{s.host}:#{s.port}#{path}", url: true)
  expect(@session.current_url.chomp('?')).to eq("#{scheme}://#{s.host}:#{s.port}#{path}")
  expect(@session.current_host).to eq("#{scheme}://#{s.host}") # no port
  expect(@session.current_path).to eq(path)
  if path == '/host'
    # Server should agree with us
    expect(@session).to have_content("Current host is #{scheme}://#{s.host}:#{s.port}")
  end
end