Class: SixthSense::MutationScoreCacheWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/sixth_sense/mutation_score_cache_writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache:) ⇒ MutationScoreCacheWriter

Returns a new instance of MutationScoreCacheWriter.



10
11
12
# File 'lib/sixth_sense/mutation_score_cache_writer.rb', line 10

def initialize(cache:)
  @cache = cache
end

Instance Method Details

#write(plan, stdout:, stderr:) ⇒ Object



14
15
16
17
18
19
# File 'lib/sixth_sense/mutation_score_cache_writer.rb', line 14

def write(plan, stdout:, stderr:)
  score = parse_mutation_score([stdout, stderr].join("\n"))
  return false unless score

  write_score(plan, score)
end

#write_score(plan, score) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/sixth_sense/mutation_score_cache_writer.rb', line 21

def write_score(plan, score)
  mutation_cache = MutationCache.new(root: @cache)
  plan.test_files.each do |test_file|
    mutation_cache.write(test_file_model(test_file), payload(plan, score))
  end
  true
end