Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 415845d

Browse files
committed
Simplify BisectFormatter using example_finished notification.
We did not offer it when the BisectFormatter was written but it nicely simplifies it now.
1 parent b48d851 commit 415845d

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/rspec/core/formatters/bisect_formatter.rb

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Formatters
1313
# @private
1414
class BisectFormatter
1515
Formatters.register self, :start, :start_dump, :example_started,
16-
:example_failed, :example_passed, :example_pending
16+
:example_failed, :example_finished
1717

1818
def initialize(_output)
1919
port = RSpec.configuration.drb_port
@@ -35,15 +35,15 @@ def example_started(notification)
3535

3636
def example_failed(notification)
3737
@failed_example_ids << notification.example.id
38-
example_finished(notification, :failed)
3938
end
4039

41-
def example_passed(notification)
42-
example_finished(notification, :passed)
43-
end
40+
def example_finished(notification)
41+
return unless @remaining_failures.include?(notification.example.id)
42+
@remaining_failures.delete(notification.example.id)
4443

45-
def example_pending(notification)
46-
example_finished(notification, :pending)
44+
status = notification.example.execution_result.status
45+
return if status == :failed && !@remaining_failures.empty?
46+
RSpec.world.wants_to_quit = true
4747
end
4848

4949
def start_dump(_notification)
@@ -53,16 +53,6 @@ def start_dump(_notification)
5353
end
5454

5555
RunResults = Struct.new(:all_example_ids, :failed_example_ids)
56-
57-
private
58-
59-
def example_finished(notification, status)
60-
return unless @remaining_failures.include?(notification.example.id)
61-
@remaining_failures.delete(notification.example.id)
62-
63-
return if status == :failed && !@remaining_failures.empty?
64-
RSpec.world.wants_to_quit = true
65-
end
6656
end
6757
end
6858
end

0 commit comments

Comments
 (0)