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.



111
112
113
# File 'lib/junit_merge/app.rb', line 111

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

Instance Method Details

#add(test_node, delta) ⇒ Object



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

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



122
123
124
125
126
127
128
# File 'lib/junit_merge/app.rb', line 122

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