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

Commit 4e906eb

Browse files
committed
enforce notify only sending internal notifications
1 parent a7b1037 commit 4e906eb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/support/formatter_support.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,20 @@ def profile_notification(duration, examples, number)
275275
end
276276

277277
end
278+
279+
if RSpec::Support::RubyFeatures.module_prepends_supported?
280+
module RSpec::Core
281+
class Reporter
282+
module EnforceRSpecNotificationsListComplete
283+
def notify(event, *args)
284+
return super if caller_locations(1, 1).first.label =~ /publish/
285+
return super if RSPEC_NOTIFICATIONS.include?(event)
286+
287+
raise "#{event.inspect} must be added to `RSPEC_NOTIFICATIONS`"
288+
end
289+
end
290+
291+
prepend EnforceRSpecNotificationsListComplete
292+
end
293+
end
294+
end

0 commit comments

Comments
 (0)