@@ -52,7 +52,9 @@ class NotificationsMainTest < Test::Unit::TestCase
52
52
def setup
53
53
@events = [ ]
54
54
Thread . abort_on_exception = true
55
- ActiveSupport ::Notifications . subscribe { |event | @events << event }
55
+ ActiveSupport ::Notifications . subscribe do |*args |
56
+ @events << ActiveSupport ::Notifications ::Event . new ( *args )
57
+ end
56
58
end
57
59
58
60
def teardown
@@ -124,7 +126,11 @@ def test_event_is_pushed_even_without_block
124
126
125
127
def test_subscriber_with_pattern
126
128
@another = [ ]
127
- ActiveSupport ::Notifications . subscribe ( "cache" ) { |event | @another << event }
129
+
130
+ ActiveSupport ::Notifications . subscribe ( "cache" ) do |*args |
131
+ @another << ActiveSupport ::Notifications ::Event . new ( *args )
132
+ end
133
+
128
134
ActiveSupport ::Notifications . instrument ( :cache ) { 1 }
129
135
130
136
sleep ( 0.1 )
@@ -136,7 +142,9 @@ def test_subscriber_with_pattern
136
142
137
143
def test_subscriber_with_pattern_as_regexp
138
144
@another = [ ]
139
- ActiveSupport ::Notifications . subscribe ( /cache/ ) { |event | @another << event }
145
+ ActiveSupport ::Notifications . subscribe ( /cache/ ) do |*args |
146
+ @another << ActiveSupport ::Notifications ::Event . new ( *args )
147
+ end
140
148
141
149
ActiveSupport ::Notifications . instrument ( :something ) { 0 }
142
150
ActiveSupport ::Notifications . instrument ( :cache ) { 1 }
@@ -150,7 +158,9 @@ def test_subscriber_with_pattern_as_regexp
150
158
151
159
def test_with_several_consumers_and_several_events
152
160
@another = [ ]
153
- ActiveSupport ::Notifications . subscribe { |event | @another << event }
161
+ ActiveSupport ::Notifications . subscribe do |*args |
162
+ @another << ActiveSupport ::Notifications ::Event . new ( *args )
163
+ end
154
164
155
165
1 . upto ( 100 ) do |i |
156
166
ActiveSupport ::Notifications . instrument ( :value ) { i }
0 commit comments