diff options
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/notifications_test.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/railties/test/application/notifications_test.rb b/railties/test/application/notifications_test.rb index 71e406f2c1..8229e83147 100644 --- a/railties/test/application/notifications_test.rb +++ b/railties/test/application/notifications_test.rb @@ -1,27 +1,35 @@ require "isolation/abstract_unit" module ApplicationTests - class NotificationsTest < Test::Unit::TestCase - include ActiveSupport::Testing::Isolation + class MyQueue + def publish(name, *args) + raise name + end - class MyQueue - def publish(name, *args) - raise name - end + # Not a full queue implementation + def method_missing(name, *args, &blk) + self end + end + + class NotificationsTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation def setup build_app boot_rails - require "rails" require "active_support/notifications" @events = [] - Rails::Initializer.run do |c| - c.notifications.notifier = ActiveSupport::Notifications::Notifier.new(MyQueue.new) - end + + add_to_config <<-RUBY + config.notifications.notifier = ActiveSupport::Notifications::Notifier.new(ApplicationTests::MyQueue.new) + RUBY end test "new queue is set" do + use_frameworks [] + require "#{app_path}/config/environment" + assert_raise RuntimeError do ActiveSupport::Notifications.publish('foo') end |