Class: MiniAuth::TestGuard

Inherits:
Guard
  • Object
show all
Defined in:
lib/mini_auth/test_guard.rb

Instance Method Summary collapse

Methods inherited from Guard

#guest?, #logged_in?

Instance Method Details

#attempt!(credentials, remember = nil) ⇒ Object

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/mini_auth/test_guard.rb', line 4

def attempt!(credentials, remember = nil)
  raise NotImplementedError, 'Testing guard does not support login attempts.'
end

#auth_urlObject



20
21
22
# File 'lib/mini_auth/test_guard.rb', line 20

def auth_url
  '/login'
end

#login!(user, remember = nil) ⇒ Object



8
9
10
# File 'lib/mini_auth/test_guard.rb', line 8

def login!(user, remember = nil)
  @user = user
end

#logout!Object



12
13
14
# File 'lib/mini_auth/test_guard.rb', line 12

def logout!
  @user = nil
end

#userObject



16
17
18
# File 'lib/mini_auth/test_guard.rb', line 16

def user
  @user ||= nil
end