Sha256: bb33d0630fa7a88f2d826a83949e2df831c2aadbe6749830c46f56cb35b41fcc
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
# frozen_string_literal: true # Provide access to the scenario_run_registry database table which registers each run of tests made over time. module QaServer class ScenarioRunRegistry < ActiveRecord::Base self.table_name = 'scenario_run_registry' has_many :scenario_run_history, foreign_key: :scenario_run_registry_id # @return [ScenarioRunRegistry] registry data for latest run (e.g. id, dt_stamp) 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 # @return [Integer] id for latest test run # @deprecated Not used anywhere. Being removed. def self.latest_run_id latest = latest_run return nil unless latest lastest.id end deprecation_deprecate latest_run_id: "Not used anywhere. Being removed." # @return [String] datetime stamp of first registered run def self.first_run_dt Rails.cache.fetch("#{self.class}/#{__method__}", expires_in: QaServer.cache_expiry, race_condition_ttl: 1.hour) do QaServer::ScenarioRunRegistry.first.dt_stamp.in_time_zone("Eastern Time (US & Canada)").strftime("%m/%d/%y - %I:%M %p") end end # Register and save latest test run results # @param scenarios_results [Array<Hash>] results of latest test run def self.save_run(scenarios_results:) run = QaServer::ScenarioRunRegistry.create(dt_stamp: QaServer.current_time) scenarios_results.each { |result| QaServer::ScenarioRunHistory.save_result(run_id: run.id, scenario_result: result) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qa_server-5.5.1 | app/models/qa_server/scenario_run_registry.rb |
qa_server-5.5.0 | app/models/qa_server/scenario_run_registry.rb |