test/helpers/user_helpers.rb
# by passes devise methods needed to login
# you can pass either id or uid or role and will return the user.
by passes devise methods needed to login
you can pass either id or uid or role and will return the user.
by passes devise methods needed to login you can pass either id or uid or role and will return the user .
def mock_login(id: nil, uid: nil, role: nil)
      user = User.find_by role: role unless role == nil
      user = User.find_by uid: uid unless uid == nil
      user = User.find_by id: id unless id == nil
      ApplicationController.any_instance.stubs(:authenticate_user!).returns(true)
      ApplicationController.any_instance.stubs(:user_signed_in).returns(true)
      ApplicationController.any_instance.stubs(:current_user).returns(user)
    end
def mock_login ( id : nil , uid : nil , role : nil ) user = User . find_by role : role unless role == nil user = User . find_by uid : uid unless uid == nil user = User . find_by id : id unless id == nil ApplicationController . any_instance . stubs ( :authenticate_user! ) . returns ( true ) ApplicationController . any_instance . stubs ( :user_signed_in ) . returns ( true ) ApplicationController . any_instance . stubs ( :current_user ) . returns ( user ) end
by passes devise methods needed to login
you can pass either id or uid or role and will return the user.
by passes devise methods needed to login you can pass either id or uid or role and will return the user .
id
<not_specific>
uid
<not_specific>
role
<not_specific>