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

Commit d7b9f9c

Browse files
committed
skip output check if output not defined on formatter
1 parent 42a9fe3 commit d7b9f9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/rspec/core/formatters.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,16 @@ def register(formatter, notifications)
194194

195195
def duplicate_formatter_exists?(new_formatter)
196196
@formatters.any? do |formatter|
197-
formatter.class == new_formatter.class && formatter.output == new_formatter.output
197+
formatter.class == new_formatter.class &&
198+
has_matching_output?(formatter, new_formatter)
198199
end
199200
end
200201

202+
def has_matching_output?(formatter, new_formatter)
203+
return true unless formatter.respond_to?(:output) && new_formatter.respond_to?(:output)
204+
formatter.output == new_formatter.output
205+
end
206+
201207
def existing_formatter_implements?(notification)
202208
@reporter.registered_listeners(notification).any?
203209
end

0 commit comments

Comments
 (0)