diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-12 17:48:09 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-13 01:19:23 +0100 |
commit | fe3ceabeed6bde67eb9c0e64b27e133a66e13d83 (patch) | |
tree | 523dcb635d1d8934e035e54c8ece3b49413688ed /railties/test/subscriber_test.rb | |
parent | 7f25ccf38d6cab2b96494ed1a6b7cdffeef8eae7 (diff) | |
download | rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.tar.gz rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.tar.bz2 rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.zip |
Set up subscriber on initialization.
Diffstat (limited to 'railties/test/subscriber_test.rb')
-rw-r--r-- | railties/test/subscriber_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/test/subscriber_test.rb b/railties/test/subscriber_test.rb index ada40e2d2b..0d8793abab 100644 --- a/railties/test/subscriber_test.rb +++ b/railties/test/subscriber_test.rb @@ -22,7 +22,10 @@ ActiveSupport::Notifications.subscribe do |*args| end class MySubscriber < Rails::Subscriber + attr_reader :event + def some_event(event) + @event = event info event.name end @@ -85,6 +88,13 @@ class SubscriberTest < ActiveSupport::TestCase assert_equal %w(my_subscriber.some_event), @logger.logged(:info) end + def test_event_is_an_active_support_notifications_event + Rails::Subscriber.add :my_subscriber, @subscriber + instrument "my_subscriber.some_event" + wait + assert_kind_of ActiveSupport::Notifications::Event, @subscriber.event + end + def test_does_not_send_the_event_if_it_doesnt_match_the_class Rails::Subscriber.add :my_subscriber, @subscriber instrument "my_subscriber.unknown_event" |