Class: Lita::Handlers::GhostInspectorSuites

Inherits:
Handler
  • Object
show all
Includes:
LitaGhostInspector::API, LitaGhostInspector::Config, LitaGhostInspector::Utility
Defined in:
lib/lita/handlers/ghost_inspector_suites.rb

Instance Method Summary collapse

Methods included from LitaGhostInspector::Utility

#seconds_to_human

Methods included from LitaGhostInspector::API

#gi_api, #gi_get

Methods included from LitaGhostInspector::Config

#config

Instance Method Details

#execute(response) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/lita/handlers/ghost_inspector_suites.rb', line 25

def execute(response)
  suite_name = response.matches[0][0]
  suite_id = suite_id_by_name suite_name
  execute_response = gi_get "/suites/#{suite_id}/execute", immediate: true
  if execute_response == {}
    response.reply "Started #{suite_name} suite..."
  end
end

#list(response) ⇒ Object



16
17
18
19
# File 'lib/lita/handlers/ghost_inspector_suites.rb', line 16

def list(response)
  suites_response = suites.map{ |suite| "#{suite["name"]} - #{suite["testCount"]} tests" }
  response.reply suites_response.join "\n"
end

#list_tests(response) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/lita/handlers/ghost_inspector_suites.rb', line 38

def list_tests(response)
  suite_name = response.matches[0][0]
  suite_id = suite_id_by_name suite_name
  tests = gi_get "/suites/#{suite_id}/tests"
  tests_response = tests.map{ |test|
    "#{test["name"]} - " +
    "#{test["passing"] ? "Passing" : "*Not passing*"}" +
    " with screenshot " +
    "#{test["screenshotComparePassing"] ? "passing" : "*not passing*"}" +
    ". " +
    "Runs #{seconds_to_human test["testFrequency"]}. "
  }
  response.reply tests_response.join "\n"
end