Module: RSpecTracer::Example

Defined in:
lib/rspec_tracer/example.rb

Overview

Builds the identity-hash payload (‘:example_id`-keyed Hash) that RSpec::RunnerHook attaches to every example pre-run.

All methods declared ‘def self.x` + `private_class_method` for the private helpers per feedback_mutation_friendly_modules: mutant maps tests to the singleton form. Public API (`Example.from`) is the only call site `runner_hook.rb` + the runner-hook spec drive; the three private helpers stay reachable only from `from` itself.

Class Method Summary collapse

Class Method Details

.from(example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal helper for the tracer pipeline.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rspec_tracer/example.rb', line 16

def self.from(example)
  data = {
    example_group: example.example_group.name,
    description: example.description,
    full_description: example.full_description,
    shared_group: example.[:shared_group_inclusion_backtrace]
      .map(&:formatted_inclusion_location)
  }.merge(example_location(example))

  data.merge(example_id: Digest::MD5.hexdigest(data.to_json))
end