Sha256: 5993d4df66f73c176ad388ee689e08a9c82425f2dc7e08e68d17e65409f235f2

Contents?: true

Size: 821 Bytes

Versions: 9

Compression:

Stored size: 821 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Ably::Rest::Client do
  subject do
    Ably::Rest::Client.new(client_options)
  end

  context 'initializer options' do
    context 'default agent' do
      let(:client_options) { { key: 'appid.keyuid:keysecret' } }

      it 'should return Ably::AGENT identifier' do
        expect(subject.agent).to eq(Ably::AGENT)
      end

      it 'should show ably-ruby ruby and ably-ruby-rest identifier' do
        expect(subject.agent).to match(/^ably-ruby\/\d.\d.\d ruby\/\d.\d.\d ably-ruby-rest$/)
      end
    end

    context 'custom agent' do
      let(:client_options) { { key: 'appid.keyuid:keysecret', agent: 'my-custom-agent/1.1' } }

      it 'should show my-custom-agent/1.1' do
        expect(subject.agent).to eq('my-custom-agent/1.1')
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ably-rest-1.2.7 spec/unit/client_spec.rb
ably-rest-1.2.6 spec/unit/client_spec.rb
ably-rest-1.2.4 spec/unit/client_spec.rb
ably-rest-1.2.3 spec/unit/client_spec.rb
ably-rest-1.2.2 spec/unit/client_spec.rb
ably-rest-1.2.1 spec/unit/client_spec.rb
ably-rest-1.2.0 spec/unit/client_spec.rb
ably-rest-1.1.8 spec/unit/client_spec.rb
ably-rest-1.1.7 spec/unit/client_spec.rb