Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec_junit_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def xml_dump
output << %{ tests="#{example_count}"}
output << %{ skipped="#{pending_count}"}
output << %{ failures="#{failure_count}"}
output << %{ errors="0"}
output << %{ errors="#{error_count}"}
output << %{ time="#{escape("%.6f" % duration)}"}
output << %{ timestamp="#{escape(started.iso8601)}"}
output << %{ hostname="#{escape(Socket.gethostname)}"}
Expand Down
4 changes: 4 additions & 0 deletions lib/rspec_junit_formatter/rspec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def failure_for(example)
"#{message}\n#{backtrace.join("\n")}"
end

def error_count
0
end

def find_shared_group(example)
group_and_parent_groups(example).find { |group| group.metadata[:shared_group_name] }
end
Expand Down
9 changes: 9 additions & 0 deletions lib/rspec_junit_formatter/rspec3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ def examples
@examples_notification.notifications
end

def error_count
# Introduced in rspec 3.6
if @summary_notification.respond_to?(:errors_outside_of_examples_count)
@summary_notification.errors_outside_of_examples_count
else
0
end
end

def result_of(notification)
notification.example.execution_result.status
end
Expand Down