Sha256: 5239daa02d2dcfe67c0da86aaa2fbdbecbca9aaefadbc392f488bbf2c1768cc9
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 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 ROQUA_CORE_KEY env variable' do orginal_env_core_key = ENV['ROQUA_CORE_KEY'] ENV['ROQUA_CORE_KEY'] = 'some_env_core_key' session = Roqua::CoreApi.basic_auth_session ENV['ROQUA_CORE_KEY'] = orginal_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 ROQUA_CORE_SECRET env variable' do orginal_env_core_secret = ENV['ROQUA_CORE_SECRET'] ENV['ROQUA_CORE_SECRET'] = 'some_env_core_secret' session = Roqua::CoreApi.basic_auth_session ENV['ROQUA_CORE_SECRET'] = orginal_env_core_secret expect(session.password).to eq('some_env_core_secret') end it 'allows to override the core_host variable' do session = Roqua::CoreApi.basic_auth_session core_host: 'some_core_host' expect(session.core_host).to eq('some_core_host') end it 'defaults the AuthSession core_host ROQUA_CORE_HOST env variable default value' do orginal_env_core_host = ENV['ROQUA_CORE_HOST'] ENV['ROQUA_CORE_HOST'] = 'some_env_core_host' session = Roqua::CoreApi.basic_auth_session ENV['ROQUA_CORE_HOST'] = orginal_env_core_host expect(session.core_host).to eq('some_env_core_host') 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
roqua-core-api-0.0.11 | spec/lib/roqua/core_api/sessions/basic_auth_session_spec.rb |
roqua-core-api-0.0.10 | spec/lib/roqua/core_api/sessions/basic_auth_session_spec.rb |