tests: fix authentication in controller tests.
Fix controller tests to login for real instead of faking it.
This commit is contained in:
@@ -14,9 +14,7 @@ class SessionLoader
|
||||
CurrentUser.user = User.anonymous
|
||||
CurrentUser.ip_addr = request.remote_ip
|
||||
|
||||
if Rails.env.test? && Thread.current[:test_user_id]
|
||||
load_for_test(Thread.current[:test_user_id])
|
||||
elsif session[:user_id]
|
||||
if session[:user_id]
|
||||
load_session_user
|
||||
elsif cookie_password_hash_valid?
|
||||
load_cookie_user
|
||||
@@ -34,11 +32,6 @@ class SessionLoader
|
||||
|
||||
private
|
||||
|
||||
def load_for_test(user_id)
|
||||
CurrentUser.user = User.find(user_id)
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
end
|
||||
|
||||
def set_statement_timeout
|
||||
timeout = CurrentUser.user.statement_timeout
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = #{timeout}")
|
||||
|
||||
Reference in New Issue
Block a user