Module: Inferno::Config::Boot::Suites
- Defined in:
- lib/inferno/config/boot/suites.rb
Overview
Extracted from the :suites provider below so the enable_when validation can be unit tested against plain Test/TestGroup/TestSuite classes, instead of requiring a full application boot (which only happens once per process) just to exercise the raise.
Class Method Summary collapse
-
.check_enable_when_errors!(descendant) ⇒ Object
A circular or undefined enable_when dependency means the input involved can never be enabled, so this is treated as fatal at load time rather than left for developers to discover once the suite is already running.
Class Method Details
.check_enable_when_errors!(descendant) ⇒ Object
A circular or undefined enable_when dependency means the input
involved can never be enabled, so this is treated as fatal at load
time rather than left for developers to discover once the suite is
already running. enable_when is uninheritable, so a problem local
to a group or test can be hidden from the suite's own merged view if
a parent re-declares the same input name without repeating
enable_when -- checking every runnable in the tree, not just the
suite, is what catches that case.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/inferno/config/boot/suites.rb', line 19 def check_enable_when_errors!(descendant) [*descendant.all_descendants.reverse, descendant].each do |runnable| enable_when_errors = runnable. next if enable_when_errors.empty? raise StandardError, "Error initializing test suite #{descendant.name} (id: #{descendant.id}) " \ "in '#{runnable.title || runnable.id}' (id: #{runnable.id}):\n- #{enable_when_errors.join("\n- ")}" end end |