lib/onceover/rspec/formatters.rb in onceover-3.19.0 vs lib/onceover/rspec/formatters.rb in onceover-3.19.1
- old
+ new
@@ -10,11 +10,13 @@
:example_pending,
:dump_failures,
)
COMPILATION_ERROR = %r{error during compilation: (?<error>.*)}
+ # rubocop:disable Lint/MixedRegexpCaptureTypes
ERROR_WITH_LOCATION = %r{(?<error>.*?)\s(at )?(\((file: (?<file>.*?), )?line: (?<line>\d+)(, column: (?<column>\d+))?\))(; )?}
+ # rubocop:enable Lint/MixedRegexpCaptureTypes
ERROR_WITHOUT_LOCATION = %r{(?<error>.*?)\son node}
def initialize output
@output = output
@previous_role = nil
@@ -70,10 +72,12 @@
end
@output << "\n"
end
+ # rubocop:disable Style/CombinableLoops
+ #
# This method takes a notification and formats it into a hash that can be
# printed easily
def extract_failures notification
# Group by role
grouped = notification.failed_examples.group_by { |e| e.metadata[:example_group][:parent_example_group][:description]}
@@ -88,10 +92,11 @@
grouped[role] = failures.map { |_description, fails| extract_failure_data(fails)}.flatten
end
grouped
end
+ # rubocop:enable Style/CombinableLoops
# Extaracts data out of RSpec failres
def extract_failure_data(fails)
# The only difference between these failures should be the factsets that it
# failed on. Extract that list then just use the first failure for the rest
@@ -307,6 +312,6 @@
f.puts "#{fe.metadata[:file_path]}:#{fe.metadata[:line_number]}"
f.puts "------------------------------------------------------"
end
}
end
-end
\ No newline at end of file
+end