Sha256: 046940ec14e00fce776eed77d7017728759c94294f683d426183eac5bc0c2f55
Contents?: true
Size: 1.17 KB
Versions: 33
Compression:
Stored size: 1.17 KB
Contents
describe QuizApiClient::Services::BaseApiService do let(:consumer_key) { 'consumer key' } let(:host) { 'api.host' } let(:shared_secret) { 'secret' } let(:protocol) { 'http' } let(:service_class) do Class.new(QuizApiClient::Services::BaseApiService) do def test_uri uri end end end let(:service) do service_class.new(QuizApiClient::Config.new do |c| c.consumer_key = consumer_key c.host = host c.shared_secret = shared_secret c.protocol = protocol end) end def decode_token(token, secret) JWT.decode( token, secret, true, algorithm: QuizApiClient::Services::JwtService::HASHING_ALGORITHM ) end describe '#uri' do it 'returns full URI' do expect(service.test_uri).to eq 'http://api.host' end context 'with https protocol' do let(:protocol) { 'https' } it 'uses specified protocol' do expect(service.test_uri).to eq 'https://api.host' end end context 'with port specified in host' do let(:host) { 'api.host:8443' } it 'includes port in URI' do expect(service.test_uri).to eq 'http://api.host:8443' end end end end
Version data entries
33 entries across 33 versions & 1 rubygems