Class: Juniter::TestResult
- Defined in:
- lib/juniter/test_result.rb
Constant Summary collapse
- VALID_STATUSES =
%i{ pass fail error skip }.freeze
- ELEMENT_TO_STATUS_MAP =
{ "skipped" => :skip, "failure" => :fail }.freeze
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status) ⇒ TestResult
constructor
A new instance of TestResult.
- #tag ⇒ Object
- #to_xml ⇒ Object
Methods inherited from Element
Methods included from HasChildren
#assign_children_from_xml, #children_xml, included
Methods included from HasAttributes
#assign_attributes_from_xml, included, #xml_attributes
Constructor Details
#initialize(status) ⇒ TestResult
Returns a new instance of TestResult.
21 22 23 |
# File 'lib/juniter/test_result.rb', line 21 def initialize(status) self.status = status.to_sym end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
25 26 27 |
# File 'lib/juniter/test_result.rb', line 25 def status @status end |
Class Method Details
.from_xml(node) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/juniter/test_result.rb', line 12 def from_xml(node) status = ELEMENT_TO_STATUS_MAP.fetch(node.value, node.value) new(status).tap do |element| element.assign_attributes_from_xml(node) element.assign_children_from_xml(node.nodes) end end |
Instance Method Details
#tag ⇒ Object
37 38 39 |
# File 'lib/juniter/test_result.rb', line 37 def tag ELEMENT_TO_STATUS_MAP.invert.fetch(status, status.to_s) end |
#to_xml ⇒ Object
32 33 34 35 |
# File 'lib/juniter/test_result.rb', line 32 def to_xml return nil if pass? super end |