Class: JunitMerge::App::SummaryDiff

Inherits:
Struct
  • Object
show all
Defined in:
lib/junit_merge/app.rb

Instance Method Summary collapse

Constructor Details

#initializeSummaryDiff

Returns a new instance of SummaryDiff.



103
104
105
# File 'lib/junit_merge/app.rb', line 103

def initialize
  self.tests = self.failures = self.errors = self.skipped = 0
end

Instance Method Details

#add(test_node, delta) ⇒ Object



107
108
109
110
111
112
# File 'lib/junit_merge/app.rb', line 107

def add(test_node, delta)
  self.tests += delta
  self.failures += delta if !test_node.xpath('failure').empty?
  self.errors += delta if !test_node.xpath('error').empty?
  self.skipped += delta if !test_node.xpath('skipped').empty?
end

#apply_to(node) ⇒ Object



114
115
116
117
118
119
120
# File 'lib/junit_merge/app.rb', line 114

def apply_to(node)
  %w[tests failures errors skipped].each do |attribute|
    if (value = node[attribute])
      node[attribute] = value.to_i + send(attribute)
    end
  end
end