File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
lib/active_support/notifications Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ def unsubscribe(subscriber_or_name)
68
68
end
69
69
end
70
70
71
+ def inspect # :nodoc:
72
+ total_patterns = @string_subscribers . size + @other_subscribers . size
73
+ "#<#{ self . class } (#{ total_patterns } patterns)>"
74
+ end
75
+
71
76
def start ( name , id , payload )
72
77
iterate_guarding_exceptions ( listeners_for ( name ) ) { |s | s . start ( name , id , payload ) }
73
78
end
Original file line number Diff line number Diff line change @@ -231,6 +231,13 @@ def test_monotonic_timed_subscribed
231
231
end
232
232
end
233
233
234
+ class InspectTest < TestCase
235
+ def test_inspect_output_is_small
236
+ expected = "#<ActiveSupport::Notifications::Fanout (2 patterns)>"
237
+ assert_equal expected , @notifier . inspect
238
+ end
239
+ end
240
+
234
241
class UnsubscribeTest < TestCase
235
242
def test_unsubscribing_removes_a_subscription
236
243
@notifier . publish :foo
You can’t perform that action at this time.
0 commit comments