Module: Trainer::XCResult::TestCaseAttributes::ClassMethods
- Defined in:
- trainer/lib/trainer/xcresult/test_case_attributes.rb
Instance Method Summary collapse
- #extract_attachments(node) ⇒ Object
- #extract_failure_messages(node) ⇒ Object
- #extract_source_references(node) ⇒ Object
- #parse_duration(duration_str) ⇒ Object
Instance Method Details
#extract_attachments(node) ⇒ Object
41 42 43 44 45 |
# File 'trainer/lib/trainer/xcresult/test_case_attributes.rb', line 41 def (node) node['children'] &.select { |child| child['nodeType'] == 'Attachment' } &.map { || ['name'] } || [] end |
#extract_failure_messages(node) ⇒ Object
29 30 31 32 33 |
# File 'trainer/lib/trainer/xcresult/test_case_attributes.rb', line 29 def (node) node['children'] &.select { |child| child['nodeType'] == 'Failure Message' } &.map { |msg| msg['name'] } || [] end |
#extract_source_references(node) ⇒ Object
35 36 37 38 39 |
# File 'trainer/lib/trainer/xcresult/test_case_attributes.rb', line 35 def extract_source_references(node) node['children'] &.select { |child| child['nodeType'] == 'Source Code Reference' } &.map { |ref| ref['name'] } || [] end |
#parse_duration(duration_str) ⇒ Object
22 23 24 25 26 27 |
# File 'trainer/lib/trainer/xcresult/test_case_attributes.rb', line 22 def parse_duration(duration_str) return 0.0 if duration_str.nil? # Handle comma-separated duration, and remove 's' suffix duration_str.gsub(',', '.').chomp('s').to_f end |