code layout cleanup test/functional/users_controller_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9730 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-05-28 07:07:00 +00:00
parent 9aef7a3242
commit 87783362cf
1 changed files with 6 additions and 8 deletions

View File

@ -24,7 +24,9 @@ class UsersController; def rescue_action(e) raise e end; end
class UsersControllerTest < ActionController::TestCase
include Redmine::I18n
fixtures :users, :projects, :members, :member_roles, :roles, :custom_fields, :custom_values, :groups_users, :auth_sources
fixtures :users, :projects, :members, :member_roles, :roles,
:custom_fields, :custom_values, :groups_users,
:auth_sources
def setup
@controller = UsersController.new
@ -156,7 +158,6 @@ class UsersControllerTest < ActionController::TestCase
def test_new
get :new
assert_response :success
assert_template :new
assert assigns(:user)
@ -228,14 +229,12 @@ class UsersControllerTest < ActionController::TestCase
assert_no_difference 'User.count' do
post :create, :user => {}
end
assert_response :success
assert_template 'new'
end
def test_edit
get :edit, :id => 2
assert_response :success
assert_template 'edit'
assert_equal User.find(2), assigns(:user)
@ -243,8 +242,9 @@ class UsersControllerTest < ActionController::TestCase
def test_update
ActionMailer::Base.deliveries.clear
put :update, :id => 2, :user => {:firstname => 'Changed', :mail_notification => 'only_assigned'}, :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
put :update, :id => 2,
:user => {:firstname => 'Changed', :mail_notification => 'only_assigned'},
:pref => {:hide_mail => '1', :comments_sorting => 'desc'}
user = User.find(2)
assert_equal 'Changed', user.firstname
assert_equal 'only_assigned', user.mail_notification
@ -257,14 +257,12 @@ class UsersControllerTest < ActionController::TestCase
assert_no_difference 'User.count' do
put :update, :id => 2, :user => {:firstname => ''}
end
assert_response :success
assert_template 'edit'
end
def test_update_with_group_ids_should_assign_groups
put :update, :id => 2, :user => {:group_ids => ['10']}
user = User.find(2)
assert_equal [10], user.group_ids
end