Class: Thoreau::Case::SuiteRunner
- Inherits:
-
Object
- Object
- Thoreau::Case::SuiteRunner
show all
- Includes:
- Logging
- Defined in:
- lib/thoreau/case/suite_runner.rb
Instance Method Summary
collapse
Methods included from Logging
included, logger, #logger
Constructor Details
#initialize(suite_name) ⇒ SuiteRunner
Returns a new instance of SuiteRunner.
10
11
12
|
# File 'lib/thoreau/case/suite_runner.rb', line 10
def initialize(suite_name)
@suite_name = suite_name
end
|
Instance Method Details
#run_test_cases!(cases, skipped) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/thoreau/case/suite_runner.rb', line 14
def run_test_cases! cases, skipped
legacy_data = LegacyExpectedOutcomes.new(@suite_name)
logger.info " #{@suite_name.underline.bright}"
cases.each do |c|
legacy = c.expectation == :use_legacy_snapshot
if legacy
if !legacy_data.has_saved_for?(c) ||
ENV['RESET_SNAPSHOTS']
logger.info " [#{ENV['RESET_SNAPSHOTS'] ? 'resetting' : 'saving'} legacy data]"
c.run
c.expectation = c.actual legacy_data.save!(c)
else
c.expectation = legacy_data.load_for c
end
end
c.run
if c.ok?
logger.info " #{legacy ? '▶️ ' : '✓ ' } #{c.desc}"
else
logger.error "❓ #{c.desc.bright}"
logger.error " #{c.problem.red.bright}"
end
end
logger.info (summary cases, skipped)
logger.info ""
end
|
#summary(cases, skipped) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/thoreau/case/suite_runner.rb', line 46
def summary cases, skipped
ok = cases.count(&:ok?)
total = cases.count
failed = cases.count(&:failed?)
if failed == 0
" ∴ No problems detected 👌🏾 #{skipped > 0 ? "#{skipped} skipped." : ""}"
else
" 🛑 #{failed} problem(s) detected. [#{ok} of #{total} OK#{skipped > 0 ? ", #{skipped} skipped" : ""}.]".bright
end
end
|