aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-09 14:02:38 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-09 14:02:38 -0800
commit3e02b3702ec640a521214109646bdebb5216bf96 (patch)
tree0ea1cf7e669d206ad8ab94ebde2dab7932e45c07 /activesupport/test
parente50d43a2017bea8088ecf7aab7fa632f9b80f77f (diff)
downloadrails-3e02b3702ec640a521214109646bdebb5216bf96.tar.gz
rails-3e02b3702ec640a521214109646bdebb5216bf96.tar.bz2
rails-3e02b3702ec640a521214109646bdebb5216bf96.zip
just use an attr_accessor so we do not pay ||= on every notification call
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/notifications_test.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index 9faa11efbc..7b48b3f85b 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -3,14 +3,19 @@ require 'abstract_unit'
module Notifications
class TestCase < ActiveSupport::TestCase
def setup
- ActiveSupport::Notifications.notifier = nil
- @notifier = ActiveSupport::Notifications.notifier
+ @old_notifier = ActiveSupport::Notifications.notifier
+ @notifier = ActiveSupport::Notifications::Fanout.new
+ ActiveSupport::Notifications.notifier = @notifier
@events = []
@named_events = []
@subscription = @notifier.subscribe { |*args| @events << event(*args) }
@named_subscription = @notifier.subscribe("named.subscription") { |*args| @named_events << event(*args) }
end
+ def teardown
+ ActiveSupport::Notifications.notifier = @old_notifier
+ end
+
private
def event(*args)