Commit 4345bcc848d7b91c33f8220c300eab3db5352e11

Authored by Antonio Terceiro
1 parent aa60018e

plugins/remote_user: fix tests

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