Module: Sorcery::TestHelpers::Rails::Controller

Included in:
Internal::Rails
Defined in:
lib/sorcery/test_helpers/rails/controller.rb

Instance Method Summary collapse

Instance Method Details

#logged_in?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/sorcery/test_helpers/rails/controller.rb', line 15

def logged_in?
  @controller.send(:logged_in?)
end

#login_user(user = nil, _test_context = {}) ⇒ Object



5
6
7
8
9
# File 'lib/sorcery/test_helpers/rails/controller.rb', line 5

def (user = nil, _test_context = {})
  user ||= @user
  @controller.send(:auto_login, user)
  @controller.send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secret'])
end

#logout_userObject



11
12
13
# File 'lib/sorcery/test_helpers/rails/controller.rb', line 11

def logout_user
  @controller.send(:logout)
end