summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-12-13 15:39:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-12-13 15:39:09 +0000
commitf4c37007025b5bdd018c1b95f54a077a4c52319e (patch)
tree8de70b46aa6cd6ccd19c28c784eef5bf69b90e8c /test
parent1b5a4faf0c74cd31f6f73786f8a870651305740c (diff)
downloadredmine-f4c37007025b5bdd018c1b95f54a077a4c52319e.tar.gz
redmine-f4c37007025b5bdd018c1b95f54a077a4c52319e.zip
Adds the "Hide my email address" option on the registration form (#21500).
git-svn-id: http://svn.redmine.org/redmine/trunk@14976 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/account_controller_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 8dfda0f7a..f308c935f 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -247,6 +247,18 @@ class AccountControllerTest < ActionController::TestCase
end
end
+ def test_get_register_should_show_hide_mail_preference
+ get :register
+ assert_select 'input[name=?][checked=checked]', 'pref[hide_mail]'
+ end
+
+ def test_get_register_should_show_hide_mail_preference_with_setting_turned_off
+ with_settings :default_users_hide_mail => '0' do
+ get :register
+ assert_select 'input[name=?]:not([checked=checked])', 'pref[hide_mail]'
+ end
+ end
+
# See integration/account_test.rb for the full test
def test_post_register_with_registration_on
with_settings :self_registration => '3' do
@@ -287,6 +299,22 @@ class AccountControllerTest < ActionController::TestCase
end
end
+ def test_post_register_should_create_user_with_hide_mail_preference
+ with_settings :default_users_hide_mail => '0' do
+ user = new_record(User) do
+ post :register, :user => {
+ :login => 'register',
+ :password => 'secret123', :password_confirmation => 'secret123',
+ :firstname => 'John', :lastname => 'Doe',
+ :mail => 'register@example.com'
+ }, :pref => {
+ :hide_mail => '1'
+ }
+ end
+ assert_equal true, user.pref.hide_mail
+ end
+ end
+
def test_get_lost_password_should_display_lost_password_form
get :lost_password
assert_response :success