Class: TestSteps::Handlers::PingTest

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/handlers/ping_test.rb

Instance Method Summary collapse

Methods inherited from Base

#login_button, #login_check, #login_process, #mem_word_check, #open_url_process, perform, #portal_mem_word, register

Instance Method Details

#perform(step_attributes) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/functions/handlers/ping_test.rb', line 8

def perform(step_attributes)
  url = step_attributes[:testvalue]

  while check = Net::Ping::HTTP.new(url)
    check.ping?
    sleep 5
    if check.ping? == true
      # website alive
      MyLog.log.info("pinged: #{url}")
      return true
    else
      # website not responding
      MyLog.log.warn("Failed to ping: #{url}")
      return false
    end
  end
end