Class: UnityTestResults::Namespace
- Inherits:
-
Object
- Object
- UnityTestResults::Namespace
- Defined in:
- lib/unity_test_results/domain/namespace.rb
Constant Summary collapse
- CHECKMARK =
"\u2705".freeze
- CROSSMARK =
"\u274c".freeze
- INCONCLUSIVEMARK =
"\u00B7".freeze
- FOLDER =
"\u2192".freeze
- ARROW =
"\u21b3".freeze
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_namespace(namespaces_list, test_result) ⇒ Object
- #failing_test? ⇒ Boolean
- #get_mark ⇒ Object
-
#initialize(name) ⇒ Namespace
constructor
A new instance of Namespace.
- #show_test_results(indent) ⇒ Object
- #test_color ⇒ Object
Constructor Details
#initialize(name) ⇒ Namespace
Returns a new instance of Namespace.
13 14 15 16 17 |
# File 'lib/unity_test_results/domain/namespace.rb', line 13 def initialize(name) @name = name @namespaces = {} @classes = {} end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
60 61 62 |
# File 'lib/unity_test_results/domain/namespace.rb', line 60 def classes @classes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/unity_test_results/domain/namespace.rb', line 6 def name @name end |
Instance Method Details
#add_namespace(namespaces_list, test_result) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/unity_test_results/domain/namespace.rb', line 19 def add_namespace(namespaces_list, test_result) if namespaces_list.empty? classname = test_result.classname @classes[:"#{classname}"] = ClassObject.new(classname) unless @classes.key?(:"#{classname}") @classes[:"#{classname}"].add(test_result) return end next_namespace = namespaces_list[0] if @namespaces.key?(next_namespace) else @namespaces[next_namespace] = Namespace.new(next_namespace) end namespaces_list.shift @namespaces[next_namespace].add_namespace(namespaces_list, test_result) end |
#failing_test? ⇒ Boolean
37 38 39 40 41 |
# File 'lib/unity_test_results/domain/namespace.rb', line 37 def failing_test? return @namespaces.any? {|_key, value| value.failing_test?} unless @namespaces.empty? @classes.any? {|_key, value| value.failing_test?} end |
#get_mark ⇒ Object
49 50 51 52 53 |
# File 'lib/unity_test_results/domain/namespace.rb', line 49 def get_mark return CROSSMARK if failing_test? CHECKMARK end |
#show_test_results(indent) ⇒ Object
43 44 45 46 47 |
# File 'lib/unity_test_results/domain/namespace.rb', line 43 def show_test_results(indent) puts "#{indent} #{ARROW} #{@name}".colorize(test_color) @classes.each_value {|c| c.output_result("#{indent} ")} @namespaces.each_value {|n| n.show_test_results("#{indent} ")} end |
#test_color ⇒ Object
55 56 57 58 |
# File 'lib/unity_test_results/domain/namespace.rb', line 55 def test_color return :red if failing_test? return :green unless failing_test? end |