Class: QaServer::ScenarioRunRegistry
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- QaServer::ScenarioRunRegistry
- Defined in:
- app/models/qa_server/scenario_run_registry.rb
Class Method Summary collapse
-
.first_run_dt ⇒ ActiveSupport::TimeWithZone
Datetime stamp of first registered run.
-
.latest_run ⇒ ScenarioRunRegistry
Registry data for latest run (e.g. id, dt_stamp).
-
.latest_run_id ⇒ Integer
deprecated
Deprecated.
Not used anywhere. Being removed.
-
.save_run(scenarios_results:) ⇒ Object
Register and save latest test run results.
Class Method Details
.first_run_dt ⇒ ActiveSupport::TimeWithZone
Returns datetime stamp of first registered run.
27 28 29 30 31 |
# File 'app/models/qa_server/scenario_run_registry.rb', line 27 def self.first_run_dt Rails.cache.fetch("#{self.class}/#{__method__}", expires_in: QaServer::CacheExpiryService.cache_expiry, race_condition_ttl: 30.seconds) do QaServer::ScenarioRunRegistry.first.dt_stamp end end |
.latest_run ⇒ ScenarioRunRegistry
Returns registry data for latest run (e.g. id, dt_stamp).
9 10 11 12 13 14 15 |
# File 'app/models/qa_server/scenario_run_registry.rb', line 9 def self.latest_run return nil unless QaServer::ScenarioRunRegistry.last QaServer::ScenarioRunRegistry.last # Can we count on last to always be the one with the latest dt_stamp? # latest_run = ScenarioRunRegistry.all.sort(:dt_stamp).last # return nil if latest_run.blank? # latest_run.id end |
.latest_run_id ⇒ Integer
Deprecated.
Not used anywhere. Being removed.
Returns id for latest test run.
19 20 21 22 23 |
# File 'app/models/qa_server/scenario_run_registry.rb', line 19 def self.latest_run_id latest = latest_run return nil unless latest lastest.id end |
.save_run(scenarios_results:) ⇒ Object
Register and save latest test run results
35 36 37 38 |
# File 'app/models/qa_server/scenario_run_registry.rb', line 35 def self.save_run(scenarios_results:) run = QaServer::ScenarioRunRegistry.create(dt_stamp: QaServer::TimeService.current_time) scenarios_results.each { |result| QaServer::ScenarioRunHistory.save_result(run_id: run.id, scenario_result: result) } end |