diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-11-12 14:27:08 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-11-12 15:33:02 +0000 |
commit | 70ae965de187244d5fde7dfff9c1c274fbba581f (patch) | |
tree | 5c3a49fdfe6bac044078cdabdd8dc760a67c5663 | |
parent | 3c844df6b1c97eaf2572a4db3c4dc69549982593 (diff) |
Add a dummy exception notification address for testing
ActionMailer now checks for a 'to' address on sending mail, so supply
one so that we can check exception notification mail sending. Also check
that we have one before trying to call the exception notification code.
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | config/environments/test.rb | 5 | ||||
-rw-r--r-- | config/test.yml | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbdffc441..161a82b26 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -138,7 +138,9 @@ class ApplicationController < ActionController::Base backtrace = Rails.backtrace_cleaner.clean(exception.backtrace, :silent) message << " " << backtrace.join("\n ") Rails.logger.fatal("#{message}\n\n") - ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver + if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? + ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver + end @status = 500 end respond_to do |format| diff --git a/config/environments/test.rb b/config/environments/test.rb index df39e8873..97c2d4f7c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -24,4 +24,9 @@ Alaveteli::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr + if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? + middleware.use ExceptionNotifier, + :sender_address => AlaveteliConfiguration::exception_notifications_from, + :exception_recipients => AlaveteliConfiguration::exception_notifications_to + end end diff --git a/config/test.yml b/config/test.yml index b26ca99d4..599e1e81a 100644 --- a/config/test.yml +++ b/config/test.yml @@ -116,7 +116,7 @@ HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64 # Exception notifications EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com -EXCEPTION_NOTIFICATIONS_TO: +EXCEPTION_NOTIFICATIONS_TO: exception-recipient@example.com MAX_REQUESTS_PER_USER_PER_DAY: 2 |