diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-02-05 08:50:21 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-02-05 08:50:21 +0000 |
commit | b5366eb3079c46f4fcfbe8a4172732f2abeeed96 (patch) | |
tree | d358339c3245fa0d4a4f0d886ffa55d958344f20 /test/functional/settings_controller_test.rb | |
parent | c46c0e7452a1792d11a186d1059bef52a4867cf4 (diff) | |
download | redmine-b5366eb3079c46f4fcfbe8a4172732f2abeeed96.tar.gz redmine-b5366eb3079c46f4fcfbe8a4172732f2abeeed96.zip |
Send a notification when security settings are changed (#21421).
git-svn-id: http://svn.redmine.org/redmine/trunk@15148 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/settings_controller_test.rb')
-rw-r--r-- | test/functional/settings_controller_test.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb index de5fddd8a..139eb7845 100644 --- a/test/functional/settings_controller_test.rb +++ b/test/functional/settings_controller_test.rb @@ -136,6 +136,44 @@ class SettingsControllerTest < ActionController::TestCase ], Setting.commit_update_keywords) end + def test_post_edit_should_send_security_notification_for_notified_settings + ActionMailer::Base.deliveries.clear + post :edit, :settings => { + :login_required => 1 + } + + assert_not_nil (mail = ActionMailer::Base.deliveries.last) + assert_mail_body_match '0.0.0.0', mail + assert_mail_body_match I18n.t(:setting_login_required), mail + assert_select_email do + assert_select 'a[href^=?]', 'http://localhost:3000/settings' + end + # All admins should receive this + recipients = [mail.bcc, mail.cc].flatten + User.active.where(admin: true).each do |admin| + assert_include admin.mail, recipients + end + end + + def test_post_edit_should_not_send_security_notification_for_non_notified_settings + ActionMailer::Base.deliveries.clear + post :edit, :settings => { + :app_title => 'MineRed' + } + + assert_nil (mail = ActionMailer::Base.deliveries.last) + end + + def test_post_edit_should_not_send_security_notification_for_unchanged_settings + ActionMailer::Base.deliveries.clear + post :edit, :settings => { + :login_required => 0 + } + + assert_nil (mail = ActionMailer::Base.deliveries.last) + end + + def test_get_plugin_settings ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) Redmine::Plugin.register :foo do |