From 437690119b0b1bd462d45f2367c1fe805e529972 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 28 Sep 2010 22:13:06 +0000 Subject: 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 --- test/functional/users_controller_test.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3