Class: UnityTestResults::ClassObject
- Inherits:
-
Object
- Object
- UnityTestResults::ClassObject
- Defined in:
- lib/unity_test_results/domain/class_object.rb
Constant Summary collapse
- CHECKMARK =
"\u2705".freeze
- CROSSMARK =
"\u274c".freeze
- INCONCLUSIVEMARK =
"\u00B7".freeze
- FOLDER =
"\u2192".freeze
- ARROW =
"\u2192".freeze
Instance Attribute Summary collapse
-
#test_results ⇒ Object
readonly
Returns the value of attribute test_results.
Instance Method Summary collapse
- #add(test_result) ⇒ Object
- #failing_test? ⇒ Boolean
- #get_mark ⇒ Object
-
#initialize(name) ⇒ ClassObject
constructor
A new instance of ClassObject.
- #output_result(indent) ⇒ Object
- #test_color ⇒ Object
Constructor Details
#initialize(name) ⇒ ClassObject
Returns a new instance of ClassObject.
11 12 13 14 |
# File 'lib/unity_test_results/domain/class_object.rb', line 11 def initialize(name) @name = name @test_results = [] end |
Instance Attribute Details
#test_results ⇒ Object (readonly)
Returns the value of attribute test_results.
40 41 42 |
# File 'lib/unity_test_results/domain/class_object.rb', line 40 def test_results @test_results end |
Instance Method Details
#add(test_result) ⇒ Object
16 17 18 |
# File 'lib/unity_test_results/domain/class_object.rb', line 16 def add(test_result) @test_results << test_result end |
#failing_test? ⇒ Boolean
25 26 27 |
# File 'lib/unity_test_results/domain/class_object.rb', line 25 def failing_test? @test_results.any?(&:failed?) end |
#get_mark ⇒ Object
29 30 31 32 33 |
# File 'lib/unity_test_results/domain/class_object.rb', line 29 def get_mark return CROSSMARK if failing_test? CHECKMARK end |
#output_result(indent) ⇒ Object
20 21 22 23 |
# File 'lib/unity_test_results/domain/class_object.rb', line 20 def output_result(indent) puts "#{indent} #{ARROW} #{@name}".colorize(test_color) @test_results.each {|r| r.output_result("#{indent} ")} end |
#test_color ⇒ Object
35 36 37 38 |
# File 'lib/unity_test_results/domain/class_object.rb', line 35 def test_color return :red if failing_test? return :green unless failing_test? end |