Commit 4345bcc848d7b91c33f8220c300eab3db5352e11
1 parent
aa60018e
Exists in
master
and in
29 other branches
plugins/remote_user: fix tests
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
plugins/remote_user/test/functional/remote_user_plugin_test.rb
| ... | ... | @@ -61,6 +61,8 @@ class AccountControllerTest < ActionController::TestCase |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | should 'create a new user with remote_user_data even if there is a logged user but the remote user is different' do |
| 64 | + users = User.count | |
| 65 | + | |
| 64 | 66 | user = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test') |
| 65 | 67 | user.activate |
| 66 | 68 | |
| ... | ... | @@ -71,7 +73,7 @@ class AccountControllerTest < ActionController::TestCase |
| 71 | 73 | @request.env["HTTP_REMOTE_USER_DATA"] = '{"email":"another_user@domain.com", "name":"Another User"}' |
| 72 | 74 | get :index |
| 73 | 75 | |
| 74 | - assert_equal 2, User.count | |
| 76 | + assert_equal users + 2, User.count | |
| 75 | 77 | assert_equal "another_user", User.last.login |
| 76 | 78 | assert_equal true, User.last.activated? |
| 77 | 79 | assert_equal User.last.id, session[:user] |
| ... | ... | @@ -96,6 +98,8 @@ class AccountControllerTest < ActionController::TestCase |
| 96 | 98 | end |
| 97 | 99 | |
| 98 | 100 | should 'create a new user without remote_user_data even if there is a logged user but the remote user is different' do |
| 101 | + users = User.count | |
| 102 | + | |
| 99 | 103 | user = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test') |
| 100 | 104 | user.activate |
| 101 | 105 | |
| ... | ... | @@ -104,7 +108,7 @@ class AccountControllerTest < ActionController::TestCase |
| 104 | 108 | @request.env["HTTP_REMOTE_USER"] = 'another_user' |
| 105 | 109 | get :index |
| 106 | 110 | |
| 107 | - assert_equal 2, User.count | |
| 111 | + assert_equal users + 2, User.count | |
| 108 | 112 | assert_equal "another_user", User.last.login |
| 109 | 113 | assert_equal true, User.last.activated? |
| 110 | 114 | assert_equal User.last.id, session[:user] | ... | ... |