Commit 5956ff262b275113166d544bf035ea10eb744505
1 parent
316dd059
Exists in
master
and in
28 other branches
Skip exception notification tests when it is not installed
Showing
1 changed file
with
28 additions
and
24 deletions
Show diff stats
test/integration/exception_notification_test.rb
1 | require File.dirname(__FILE__) + '/../test_helper' | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | require 'account_controller' | 2 | require 'account_controller' |
3 | -require 'exception_notification.rb' | ||
4 | -ActionController::Base.send :include, ExceptionNotifiable | ||
5 | -ExceptionNotifier.exception_recipients = ['admin@example.com', 'user@example.com'] | 3 | +begin |
4 | + require 'exception_notification.rb' | ||
5 | + ActionController::Base.send :include, ExceptionNotifiable | ||
6 | + ExceptionNotifier.exception_recipients = ['admin@example.com', 'user@example.com'] | ||
6 | 7 | ||
7 | -class ExceptionNotificationTest < ActionController::IntegrationTest | ||
8 | - def setup | ||
9 | - ActionMailer::Base.delivery_method = :test | ||
10 | - ActionMailer::Base.perform_deliveries = true | ||
11 | - ActionMailer::Base.deliveries = [] | ||
12 | - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} | ||
13 | - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} | ||
14 | - [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} | ||
15 | - end | 8 | + class ExceptionNotificationTest < ActionController::IntegrationTest |
9 | + def setup | ||
10 | + ActionMailer::Base.delivery_method = :test | ||
11 | + ActionMailer::Base.perform_deliveries = true | ||
12 | + ActionMailer::Base.deliveries = [] | ||
13 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} | ||
14 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} | ||
15 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} | ||
16 | + end | ||
16 | 17 | ||
17 | - should 'deliver mail notification about exceptions' do | ||
18 | - assert_difference ActionMailer::Base.deliveries, :size do | ||
19 | - get '/account/signup' | 18 | + should 'deliver mail notification about exceptions' do |
19 | + assert_difference ActionMailer::Base.deliveries, :size do | ||
20 | + get '/account/signup' | ||
21 | + end | ||
20 | end | 22 | end |
21 | - end | ||
22 | 23 | ||
23 | - should 'deliver mails to addresses listed in Noosfero configuration noosfero.yml' do | ||
24 | - get '/account/signup' | ||
25 | - assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'admin@example.com' | ||
26 | - assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'user@example.com' | ||
27 | - end | 24 | + should 'deliver mails to addresses listed in Noosfero configuration noosfero.yml' do |
25 | + get '/account/signup' | ||
26 | + assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'admin@example.com' | ||
27 | + assert_includes ActionMailer::Base.deliveries.map(&:to).flatten, 'user@example.com' | ||
28 | + end | ||
28 | 29 | ||
29 | - should 'render not found when try to access invalid url' do | ||
30 | - get '/profile/ze/tag/notexists' | ||
31 | - assert_template 'not_found.rhtml' | 30 | + should 'render not found when try to access invalid url' do |
31 | + get '/profile/ze/tag/notexists' | ||
32 | + assert_template 'not_found.rhtml' | ||
33 | + end | ||
32 | end | 34 | end |
35 | +rescue LoadError | ||
36 | + puts 'W: skipping exception_notification integration tests since exception_notification is not installed' | ||
33 | end | 37 | end |