Class: Evilution::Runner::BaselineRunner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/runner/baseline_runner.rb

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

Instance Method Summary collapse

Constructor Details

#initialize(config, hooks: nil) ⇒ BaselineRunner

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.

Returns a new instance of BaselineRunner.



25
26
27
28
# File 'lib/evilution/runner/baseline_runner.rb', line 25

def initialize(config, hooks: nil)
  @config = config
  @hooks = hooks
end

Instance Method Details

#base_integration_kwargsObject

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.



43
44
45
46
47
48
49
50
# File 'lib/evilution/runner/baseline_runner.rb', line 43

def base_integration_kwargs
  {
    test_files: config.spec_files.empty? ? nil : config.spec_files,
    hooks: hooks,
    fallback_to_full_suite: config.fallback_to_full_suite?,
    spec_selector: config.spec_selector
  }
end

#build_integrationObject

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.



36
37
38
39
40
41
# File 'lib/evilution/runner/baseline_runner.rb', line 36

def build_integration
  klass = integration_class
  kwargs = base_integration_kwargs
  kwargs.merge!(rspec_integration_kwargs) if klass == Evilution::Integration::RSpec
  klass.new(**kwargs)
end

#call(subjects) ⇒ 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.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/evilution/runner/baseline_runner.rb', line 59

def call(subjects)
  return nil unless config.baseline? && subjects.any?

  log_start
  baseline = Evilution::Baseline.new(
    timeout: config.timeout,
    test_files: config.spec_files.empty? ? nil : config.spec_files,
    **integration_class.baseline_options
  )
  result = baseline.call(subjects)
  log_complete(result)
  result
end

#integration_classObject

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.



30
31
32
33
34
# File 'lib/evilution/runner/baseline_runner.rb', line 30

def integration_class
  @integration_class ||= Evilution::Runner::INTEGRATIONS.fetch(config.integration) do
    raise Evilution::Error, "unknown integration: #{config.integration}"
  end
end

#neutralization_fallback_dirObject

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.



77
78
79
# File 'lib/evilution/runner/baseline_runner.rb', line 77

def neutralization_fallback_dir
  integration_class.baseline_options[:fallback_dir] || "spec"
end

#neutralization_resolverObject

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.



73
74
75
# File 'lib/evilution/runner/baseline_runner.rb', line 73

def neutralization_resolver
  integration_class.baseline_options[:spec_resolver] || Evilution::SpecResolver.new
end

#rspec_integration_kwargsObject

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.



52
53
54
55
56
57
# File 'lib/evilution/runner/baseline_runner.rb', line 52

def rspec_integration_kwargs
  {
    related_specs_heuristic: config.related_specs_heuristic?,
    example_filter: build_example_filter
  }
end