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) ⇒ Object



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

def from_violations(violations, color: nil, expected_to_pass: true)
  validate_violations(violations)
  validate_expected_to_pass(expected_to_pass)
  color = resolve_color(color)
  return empty_result(color, expected_to_pass) if violations.empty?

  failing_result(violations, color, expected_to_pass)
end