Skip to content

Commit b767bc9

Browse files
committed
Fix support for RSpec < 3.6
1 parent ba98856 commit b767bc9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/rspec_junit_formatter/rspec3.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,23 @@ def failure_message_for(example)
7777
end
7878

7979
def failure_for(notification)
80-
lines = notification.fully_formatted_lines(nil, RSpec::Core::Notifications::NullColorizer).map(&:to_s)
80+
lines = if notification.respond_to?(:fully_formatted_lines)
81+
notification.fully_formatted_lines(nil, RSpec::Core::Notifications::NullColorizer).map(&:to_s)
82+
else
83+
notification.fully_formatted(nil, RSpec::Core::Notifications::NullColorizer).split("\n")
84+
end
8185

8286
unless lines.first.empty?
8387
raise 'Expected first line to be empty'
8488
end
8589
lines.shift
8690

91+
unless notification.respond_to?(:fully_formatted_lines)
92+
if lines[0][2] == ')'
93+
lines[0][2] = ' '
94+
end
95+
end
96+
8797
indentation = lines.reject(&:empty?).map { |line| line[/^[ \t]*/] }.min
8898
lines = lines.map { |line| line.sub(/^#{Regexp.escape indentation}/, '') }
8999

0 commit comments

Comments
 (0)