Class: RSpec::Covers::Tracer::NC

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/covers/tracer/nc.rb

Instance Method Summary collapse

Instance Method Details

#score(example:, candidates:) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/rspec/covers/tracer/nc.rb', line 9

def score(example:, candidates:, **)
  expected_names = names_from_example(example)

  candidates.each_with_object({}) do |candidate, scores|
    owner = candidate.label.split(/[.#]/).first
    scores[candidate.label] = expected_names.include?(owner) ? 1.0 : 0.0
  end
end