Class: Simmer::Suite

Inherits:
Object
  • Object
show all
Defined in:
lib/simmer/suite.rb,
lib/simmer/suite/result.rb,
lib/simmer/suite/output_router.rb,
lib/simmer/suite/results_writer.rb,
lib/simmer/suite/pdi_output_writer.rb

Overview

Runs a collection of specifications and then writes down the results to disk.

Defined Under Namespace

Classes: OutputRouter, PdiOutputWriter, ResulstWriter, Result

Constant Summary collapse

LINE_LENGTH =
80

Instance Method Summary collapse

Constructor Details

#initialize(config:, out:, resolver: Objectable.resolver, results_dir:, runner:) ⇒ Suite

Returns a new instance of Suite.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/simmer/suite.rb', line 20

def initialize(
  config:,
  out:,
  resolver: Objectable.resolver,
  results_dir:,
  runner:
)
  @config      = config
  @out         = out
  @resolver    = resolver
  @results_dir = results_dir
  @runner      = runner

  freeze
end

Instance Method Details

#run(specifications) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/simmer/suite.rb', line 36

def run(specifications)
  config.run_suite_with_callbacks do
    runner_results = run_all_specs(specifications)
    runner.complete

    Result.new(runner_results).tap do |result|
      output_summary(result.pass?)

      ResulstWriter.new(result, results_dir).write!

      out.puts("Results can be viewed at #{results_dir}")
    end
  end
end