Class: Mutant::Runner::Sink::Mutation

Inherits:
Mutant::Runner::Sink show all
Defined in:
lib/mutant/runner/sink.rb

Overview

Mutation result sink

Instance Method Summary collapse

Constructor Details

#initializeundefined

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.

Initialize object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mutant/runner/sink.rb', line 43

def initialize(*)
  super
  @start           = Time.now
  @subject_results = Hash.new do |_hash, subject|
    Result::Subject.new(
      subject:          subject,
      tests:            [],
      mutation_results: []
    )
  end
end

Instance Method Details

#result(mutation_result) ⇒ self

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.

Handle mutation finish



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/mutant/runner/sink.rb', line 83

def result(mutation_result)
  mutation = mutation_result.mutation

  original = @subject_results[mutation.subject]

  @subject_results[mutation.subject] = original.update(
    mutation_results: (original.mutation_results.dup << mutation_result),
    tests:            mutation_result.test_result.tests
  )

  self
end

#statusStatus

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.

Return runner status



61
62
63
# File 'lib/mutant/runner/sink.rb', line 61

def status
  env_result
end

#stop?Boolean

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.

Test if scheduling stopped



71
72
73
# File 'lib/mutant/runner/sink.rb', line 71

def stop?
  env.config.fail_fast && !env_result.subject_results.all?(&:success?)
end