Class: QaServer::MonitorStatus::CurrentStatusPresenter
- Inherits:
-
Object
- Object
- QaServer::MonitorStatus::CurrentStatusPresenter
- Defined in:
- app/presenters/qa_server/monitor_status/current_status_presenter.rb
Instance Method Summary collapse
-
#authorities_count ⇒ Integer
Number of loaded authorities.
-
#authorities_count_style ⇒ String
Css style class representing whether all tests passed or any failed.
-
#failing_authorities_count ⇒ Integer
Number of authorities with failing tests in the latest test run.
-
#failing_tests_count ⇒ Integer
Number of failing tests in the latest test run.
-
#failing_tests_style ⇒ String
Css style class representing whether all tests passed or any failed.
-
#failures ⇒ Array<Hash>
A list of failures data in the latest test run, if any.
-
#failures? ⇒ Boolean
True if failure data exists for the latest test run; otherwise false.
-
#first_updated ⇒ String
Date with time of first recorded test run.
-
#first_updated_dt ⇒ ActiveSupport::TimeWithZone
Date time stamp of first recorded test run.
-
#initialize(parent:, current_summary:, current_failure_data:) ⇒ CurrentStatusPresenter
constructor
A new instance of CurrentStatusPresenter.
-
#last_updated ⇒ String
Date with time of last test run.
-
#last_updated_dt ⇒ ActiveSupport::TimeWithZone
Date time stamp of last test run.
-
#passing_tests_count ⇒ Integer
Number of passing tests in the latest test run.
-
#tests_count ⇒ Integer
Number of tests in the latest test run.
Constructor Details
#initialize(parent:, current_summary:, current_failure_data:) ⇒ CurrentStatusPresenter
Returns a new instance of CurrentStatusPresenter.
8 9 10 11 12 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 8 def initialize(parent:, current_summary:, current_failure_data:) @parent = parent @current_summary = current_summary @current_failure_data = current_failure_data end |
Instance Method Details
#authorities_count ⇒ Integer
Returns number of loaded authorities.
36 37 38 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 36 def @current_summary ? @current_summary. : "N/A" end |
#authorities_count_style ⇒ String
Returns css style class representing whether all tests passed or any failed.
46 47 48 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 46 def failures? ? 'status-bad' : 'status-good' end |
#failing_authorities_count ⇒ Integer
Returns number of authorities with failing tests in the latest test run.
41 42 43 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 41 def @current_failure_data ? @current_failure_data.map { |f| f[:authority_name] }.uniq.count : "N/A" end |
#failing_tests_count ⇒ Integer
Returns number of failing tests in the latest test run.
61 62 63 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 61 def failing_tests_count @current_summary ? @current_summary.failing_scenario_count : 0 end |
#failing_tests_style ⇒ String
Returns css style class representing whether all tests passed or any failed.
66 67 68 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 66 def failing_tests_style failures? ? 'summary-status-bad' : 'status-good' end |
#failures ⇒ Array<Hash>
Returns A list of failures data in the latest test run, if any.
80 81 82 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 80 def failures @current_failure_data ? @current_failure_data : [] end |
#failures? ⇒ Boolean
Returns true if failure data exists for the latest test run; otherwise false.
85 86 87 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 85 def failures? failing_tests_count.positive? && !failures.nil? end |
#first_updated ⇒ String
Returns date with time of first recorded test run.
31 32 33 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 31 def first_updated QaServer::TimeService.pretty_time(first_updated_dt) end |
#first_updated_dt ⇒ ActiveSupport::TimeWithZone
Returns date time stamp of first recorded test run.
26 27 28 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 26 def first_updated_dt QaServer::ScenarioRunRegistry.first_run_dt end |
#last_updated ⇒ String
Returns date with time of last test run.
20 21 22 23 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 20 def last_updated return I18n.t('qa_server.monitor_status.summary.no_data') if @current_summary.blank? I18n.t('qa_server.monitor_status.summary.last_updated', date: QaServer::TimeService.pretty_time(last_updated_dt)) end |
#last_updated_dt ⇒ ActiveSupport::TimeWithZone
Returns date time stamp of last test run.
15 16 17 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 15 def last_updated_dt @current_summary ? @current_summary.run_dt_stamp : QaServer::TimeService.current_time end |
#passing_tests_count ⇒ Integer
Returns number of passing tests in the latest test run.
56 57 58 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 56 def passing_tests_count @current_summary ? @current_summary.passing_scenario_count : 0 end |
#tests_count ⇒ Integer
Returns number of tests in the latest test run.
51 52 53 |
# File 'app/presenters/qa_server/monitor_status/current_status_presenter.rb', line 51 def tests_count @current_summary ? @current_summary.total_scenario_count : 0 end |