Module: UcbRailsUser::SpecHelpers

Defined in:
lib/ucb_rails_user/spec_helpers.rb

Instance Method Summary collapse

Instance Method Details

#auth_mock(uid) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ucb_rails_user/spec_helpers.rb', line 18

def auth_mock(uid)
  OmniAuth.config.mock_auth[:cas] = OmniAuth::AuthHash.new(
    provider: "cas",
    uid: uid,
    user_info: {
      name: "mockuser"
    },
    credentials: {
      token: "mock_token",
      secret: "mock_secret"
    }
  )
end

#login_user(user) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/ucb_rails_user/spec_helpers.rb', line 4

def (user)
  OmniAuth.config.test_mode = true
  auth_mock(user.ldap_uid)
  get "/login"
  follow_redirect!
  follow_redirect!
end

#system_login_user(user) ⇒ Object



12
13
14
15
16
# File 'lib/ucb_rails_user/spec_helpers.rb', line 12

def (user)
  OmniAuth.config.test_mode = true
  auth_mock(user.ldap_uid)
  visit ()
end