Sha256: 3a50c1d0158f9dad531ada5cf851504eca1bcdb3d19d7887559c60db5571532e
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
module G5Authenticatable module Test module FeatureHelpers def stub_g5_omniauth(user, options={}) OmniAuth.config.mock_auth[:g5] = OmniAuth::AuthHash.new({ uid: user.uid, provider: 'g5', info: { email: user.email, first_name: user.first_name, last_name: user.last_name, phone: user.phone_number }, credentials: {token: user.g5_access_token}, extra: { title: user.title, organization_name: user.organization_name, roles: user.roles.collect do |role| {name: role.name} end, raw_info: {} } }.merge(options)) end def stub_g5_invalid_credentials OmniAuth.config.mock_auth[:g5] = :invalid_credentials end def visit_path_and_login_with(path, user) stub_g5_omniauth(user) stub_valid_access_token(user.g5_access_token) visit path end end end end shared_context 'auth', auth: true do include G5Authenticatable::Test::FeatureHelpers let(:user) { FactoryGirl.create(:g5_authenticatable_user) } before do stub_g5_omniauth(user) stub_valid_access_token(user.g5_access_token) end end RSpec.configure do |config| config.before(:each) { OmniAuth.config.test_mode = true } config.after(:each) { OmniAuth.config.test_mode = false } config.include G5Authenticatable::Test::FeatureHelpers, type: :feature end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
g5_authenticatable-0.5.1 | lib/g5_authenticatable/test/feature_helpers.rb |
g5_authenticatable-0.5.0 | lib/g5_authenticatable/test/feature_helpers.rb |