mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Add tests
This commit is contained in:
parent
2d4ba48ad4
commit
6c8e0ce176
1 changed files with 10 additions and 2 deletions
|
@ -36,7 +36,7 @@ class UsersControllerTest < ActionController::TestCase
|
|||
assert_equal assigns['users'],[User.where(:login => 'jane').first]
|
||||
end
|
||||
|
||||
def test_destroy_user
|
||||
def test_destroy_user_as_admin
|
||||
login_as :admin_user
|
||||
@no_users_before = User.count
|
||||
user_id = users(:ldap_user).id
|
||||
|
@ -44,8 +44,16 @@ class UsersControllerTest < ActionController::TestCase
|
|||
assert_equal @no_users_before-1, User.count
|
||||
end
|
||||
|
||||
def test_destroy_user_as_user
|
||||
login_as :other_user
|
||||
@no_users_before = User.count
|
||||
user_id = users(:other_user).id
|
||||
post :destroy, xhr: true, params: { :id => user_id.to_param }
|
||||
assert_equal @no_users_before-1, User.count
|
||||
end
|
||||
|
||||
def test_update_password_successful
|
||||
get :change_password, params: { :id => users(:admin_user).id }
|
||||
get :change_password, params: { :id => users(:admin_user).id }
|
||||
# should fail because no login
|
||||
assert_redirected_to login_path
|
||||
login_as :admin_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue