Module: G5Authenticatable::Test::FeatureHelpers

Defined in:
lib/g5_authenticatable/test/feature_helpers.rb

Instance Method Summary collapse

Instance Method Details

#stub_g5_invalid_credentialsObject



13
14
15
# File 'lib/g5_authenticatable/test/feature_helpers.rb', line 13

def stub_g5_invalid_credentials
  OmniAuth.config.mock_auth[:g5] = :invalid_credentials
end

#stub_g5_omniauth(user, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/g5_authenticatable/test/feature_helpers.rb', line 4

def stub_g5_omniauth(user, options={})
  OmniAuth.config.mock_auth[:g5] = OmniAuth::AuthHash.new({
    uid: user.uid,
    provider: 'g5',
    info: {email: user.email},
    credentials: {token: user.g5_access_token}
  }.merge(options))
end

#visit_path_and_login_with(path, user) ⇒ Object



17
18
19
20
21
# File 'lib/g5_authenticatable/test/feature_helpers.rb', line 17

def (path, user)
  stub_g5_omniauth(user)
  stub_valid_access_token(user.g5_access_token)
  visit path
end