Sha256: c07fa06e94bced831a820f102c1da731aca13757a77cfc76f6e6ee6e10b94929
Contents?: true
Size: 1.99 KB
Versions: 5
Compression:
Stored size: 1.99 KB
Contents
require 'spec_helper' describe BasicAuthSession do describe '#initialize' do it 'sets the username instance variable' do session = Roqua::CoreApi.basic_auth_session username: 'some_username' expect(session.username).to eq('some_username') end it 'defaults the username to the CORE_BASICAUTH_ID env variable' do original_env_core_key = ENV['CORE_BASICAUTH_ID'] ENV['CORE_BASICAUTH_ID'] = 'some_env_core_key' session = Roqua::CoreApi.basic_auth_session ENV['CORE_BASICAUTH_ID'] = original_env_core_key expect(session.username).to eq('some_env_core_key') end it 'sets the password instance variable' do session = Roqua::CoreApi.basic_auth_session password: 'some_password' expect(session.password).to eq('some_password') end it 'defaults the password to the CORE_BASICAUTH_SECRET env variable' do original_env_core_secret = ENV['CORE_BASICAUTH_SECRET'] ENV['CORE_BASICAUTH_SECRET'] = 'some_env_core_secret' session = Roqua::CoreApi.basic_auth_session ENV['CORE_BASICAUTH_SECRET'] = original_env_core_secret expect(session.password).to eq('some_env_core_secret') end it 'allows to override the core_site variable' do session = Roqua::CoreApi.basic_auth_session core_site: 'some_core_site' expect(session.core_site).to eq('some_core_site') end it 'defaults the AuthSession core_site CORE_SITE env variable default value' do orginal_env_core_site = ENV['CORE_SITE'] ENV['CORE_SITE'] = 'some_env_core_site' session = Roqua::CoreApi.basic_auth_session ENV['CORE_SITE'] = orginal_env_core_site expect(session.core_site).to eq('some_env_core_site') end end describe '#basic_auth' do it 'returns the username and password variables' do session = Roqua::CoreApi.basic_auth_session username: 'some_username', password: 'some_password' expect(session.send :basic_auth).to eq(username: 'some_username', password: 'some_password') end end end
Version data entries
5 entries across 5 versions & 1 rubygems