diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-03 23:33:34 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-03 23:33:34 +0100 |
commit | 53c6984944b03b5de036167a418593dfcd12e886 (patch) | |
tree | 6f05fd9951fdee92e4734ec4d2ccb00b4dd76b1e /actionpack/test/dispatch | |
parent | 6fbe9ef2ffb1858027130789246f3ae24a0a182f (diff) | |
download | rails-53c6984944b03b5de036167a418593dfcd12e886.tar.gz rails-53c6984944b03b5de036167a418593dfcd12e886.tar.bz2 rails-53c6984944b03b5de036167a418593dfcd12e886.zip |
Add notifications to ActionDispatch::ShowExceptions, this can be used as hooks for plugins like ExceptionNotifier.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index 9f6a93756c..170b157d17 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -104,4 +104,24 @@ class ShowExceptionsTest < ActionController::IntegrationTest assert_response 405 assert_match /ActionController::MethodNotAllowed/, body end + + test "publishes notifications" do + @app, event = ProductionApp, nil + self.remote_addr = '127.0.0.1' + + ActiveSupport::Notifications.subscribe('action_dispatch.show_exception') do |*args| + event = args + end + + get "/" + assert_response 500 + assert_match /puke/, body + + ActiveSupport::Notifications.notifier.wait + + assert_equal 'action_dispatch.show_exception', event.first + assert_kind_of Hash, event.last[:env] + assert_equal 'GET', event.last[:env]["REQUEST_METHOD"] + assert_kind_of RuntimeError, event.last[:exception] + end end |