Sha256: 87c671e6998e1bb91bb03bd8c782b3b63ea122cfae37d84255a0a0b2b730c0aa
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 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}, credentials: {token: user.g5_access_token} }.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.4.2 | lib/g5_authenticatable/test/feature_helpers.rb |
g5_authenticatable-0.4.1 | lib/g5_authenticatable/test/feature_helpers.rb |