summaryrefslogtreecommitdiffstats
path: root/test/functional/settings_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-13 18:46:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-13 18:46:29 +0000
commitf30462595e83f512cd5f29246a4542773595a224 (patch)
tree56eb7ce08ea5a8c6e0c21806e067c8c652e652b9 /test/functional/settings_controller_test.rb
parent3186130966cea85d842faf5c038006f8fb40bb61 (diff)
downloadredmine-f30462595e83f512cd5f29246a4542773595a224.tar.gz
redmine-f30462595e83f512cd5f29246a4542773595a224.zip
Optional Regex delimiters to truncate incoming emails (#5864).
git-svn-id: http://svn.redmine.org/redmine/trunk@16065 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/settings_controller_test.rb')
-rw-r--r--test/functional/settings_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb
index 38e569569..d7dacc0ee 100644
--- a/test/functional/settings_controller_test.rb
+++ b/test/functional/settings_controller_test.rb
@@ -254,4 +254,33 @@ class SettingsControllerTest < Redmine::ControllerTest
ensure
Redmine::Plugin.unregister(:foo)
end
+
+ def test_post_mail_handler_delimiters_should_not_save_invalid_regex_delimiters
+ post :edit, :params => {
+ :settings => {
+ :mail_handler_enable_regex_delimiters => '1',
+ :mail_handler_body_delimiters => 'Abc[',
+ }
+ }
+
+ assert_response :success
+ assert_equal '0', Setting.mail_handler_enable_regex_delimiters
+ assert_equal '', Setting.mail_handler_body_delimiters
+
+ assert_select_error /is not a valid regular expression/
+ assert_select 'textarea[name=?]', 'settings[mail_handler_body_delimiters]', :text => 'Abc['
+ end
+
+ def test_post_mail_handler_delimiters_should_save_valid_regex_delimiters
+ post :edit, :params => {
+ :settings => {
+ :mail_handler_enable_regex_delimiters => '1',
+ :mail_handler_body_delimiters => 'On .*, .* at .*, .* <.*<mailto:.*>> wrote:',
+ }
+ }
+
+ assert_redirected_to '/settings'
+ assert_equal '1', Setting.mail_handler_enable_regex_delimiters
+ assert_equal 'On .*, .* at .*, .* <.*<mailto:.*>> wrote:', Setting.mail_handler_body_delimiters
+ end
end