class RSpec::Core::ExampleStatusMerger
Merges together a list of example statuses from this run and a list from previous runs (presumably loaded from disk). Each example status object is expected to be a hash with at least an ‘:example_id` and a `:status` key. Examples that were loaded but not executed (due to filtering, `–fail-fast` or whatever) should have a `:status` of `UNKNOWN_STATUS`.
This will produce a new list that:
- Will be missing examples from previous runs that we know for sure no longer exist. - Will have the latest known status for any examples that either definitively do exist or may still exist. - Is sorted by file name and example definition order, so that the saved file is easily scannable if users want to inspect it.
@private
Public Class Methods
# File rspec-core/lib/rspec/core/example_status_persister.rb, line 75 def self.merge(this_run, from_previous_runs) new(this_run, from_previous_runs).merge end
# File rspec-core/lib/rspec/core/example_status_persister.rb, line 79 def initialize(this_run, from_previous_runs) @this_run = hash_from(this_run) @from_previous_runs = hash_from(from_previous_runs) @file_exists_cache = Hash.new { |hash, file| hash[file] = File.exist?(file) } end
Public Instance Methods
# File rspec-core/lib/rspec/core/example_status_persister.rb, line 85 def merge delete_previous_examples_that_no_longer_exist @this_run.merge(@from_previous_runs) do |_ex_id, new, old| new.fetch(:status) == Configuration::UNKNOWN_STATUS ? old : new end.values.sort_by(&method(:sort_value_from)) end