From 5956ff262b275113166d544bf035ea10eb744505 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 8 Dec 2011 21:56:14 -0200 Subject: [PATCH] Skip exception notification tests when it is not installed --- test/integration/exception_notification_test.rb | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/test/integration/exception_notification_test.rb b/test/integration/exception_notification_test.rb index 6df68ab..6bac333 100644 --- a/test/integration/exception_notification_test.rb +++ b/test/integration/exception_notification_test.rb @@ -1,33 +1,37 @@ require File.dirname(__FILE__) + '/../test_helper' require 'account_controller' -require 'exception_notification.rb' -ActionController::Base.send :include, ExceptionNotifiable -ExceptionNotifier.exception_recipients = ['admin@example.com', 'user@example.com'] +begin + require 'exception_notification.rb' + ActionController::Base.send :include, ExceptionNotifiable + ExceptionNotifier.exception_recipients = ['admin@example.com', 'user@example.com'] -class ExceptionNotificationTest < ActionController::IntegrationTest - def setup - ActionMailer::Base.delivery_method = :test - ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.deliveries = [] - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} - end + class ExceptionNotificationTest < ActionController::IntegrationTest + def setup + ActionMailer::Base.delivery_method = :test + ActionMailer::Base.perform_deliveries = true + ActionMailer::Base.deliveries = [] + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} + end - should 'deliver mail notification about exceptions' do - assert_difference ActionMailer::Base.deliveries, :size do - get '/account/signup' + should 'deliver mail notification about exceptions' do + assert_difference ActionMailer::Base.deliveries, :size do + get '/account/signup' + end end - end - should 'deliver mails to addresses listed in Noosfero configuration noosfero.yml' do - get '/account/signup' - assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'admin@example.com' - assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'user@example.com' - end + should 'deliver mails to addresses listed in Noosfero configuration noosfero.yml' do + get '/account/signup' + assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'admin@example.com' + assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'user@example.com' + end - should 'render not found when try to access invalid url' do - get '/profile/ze/tag/notexists' - assert_template 'not_found.rhtml' + should 'render not found when try to access invalid url' do + get '/profile/ze/tag/notexists' + assert_template 'not_found.rhtml' + end end +rescue LoadError + puts 'W: skipping exception_notification integration tests since exception_notification is not installed' end -- libgit2 0.21.2