Class: ArchUnit::Testing::ResultFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/archunit/testing/result_factory.rb

Overview

Shapes a violation collection into one framework-neutral test result.

Class Method Summary collapse

Class Method Details

.from_violations(violations, color: nil, expected_to_pass: true, rationale: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/archunit/testing/result_factory.rb', line 14

def from_violations(violations, color: nil, expected_to_pass: true, rationale: nil)
  validate_violations(violations)
  validate_expected_to_pass(expected_to_pass)
  color = resolve_color(color)
  result = if violations.empty?
             empty_result(color, expected_to_pass)
           else
             failing_result(violations, color, expected_to_pass)
           end
  explain_result(result, rationale)
end