summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-28 22:13:06 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-28 22:13:06 +0000
commit437690119b0b1bd462d45f2367c1fe805e529972 (patch)
treeacab2ce9db00d12e8ef9ae962234f0da341e00bc /test
parent26ef9da02b7ef7550712317ad050e5a2f31744c6 (diff)
downloadredmine-437690119b0b1bd462d45f2367c1fe805e529972.tar.gz
redmine-437690119b0b1bd462d45f2367c1fe805e529972.zip
Allow admins to edit user's email notifications and preferences. #3503
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4223 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/users_controller_test.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 8e115eac6..6131c7e7d 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -127,12 +127,18 @@ class UsersControllerTest < ActionController::TestCase
:password => 'test',
:password_confirmation => 'test',
:mail => 'jdoe@gmail.com'
- }
+ },
+ :notification_option => 'none'
end
should_assign_to :user
should_respond_with :redirect
should_redirect_to('user edit') { {:controller => 'users', :action => 'edit', :id => User.find_by_login('jdoe')}}
+
+ should 'set the users mail notification' do
+ user = User.last
+ assert_equal 'none', user.mail_notification
+ end
end
context "when unsuccessful" do
@@ -149,8 +155,13 @@ class UsersControllerTest < ActionController::TestCase
def test_edit
ActionMailer::Base.deliveries.clear
- post :edit, :id => 2, :user => {:firstname => 'Changed'}
- assert_equal 'Changed', User.find(2).firstname
+ post :edit, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
+
+ user = User.find(2)
+ assert_equal 'Changed', user.firstname
+ assert_equal 'all', user.mail_notification
+ assert_equal true, user.pref[:hide_mail]
+ assert_equal 'desc', user.pref[:comments_sorting]
assert ActionMailer::Base.deliveries.empty?
end