lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb in ably-rest-0.8.2 vs lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb in ably-rest-0.8.3

- old
+ new

@@ -7,11 +7,11 @@ { key: api_key, environment: environment, protocol: protocol } end let(:client_options) { default_options } let(:connection) { subject.connection } - let(:auth_params) { subject.auth.auth_params } + let(:auth_params) { subject.auth.auth_params_sync } subject { Ably::Realtime::Client.new(client_options) } context 'initialization' do context 'basic auth' do @@ -23,18 +23,18 @@ stop_reactor end end context ':tls option' do - context 'set to false to forec a plain-text connection' do + context 'set to false to force a plain-text connection' do let(:client_options) { default_options.merge(tls: false, log_level: :none) } it 'fails to connect because a private key cannot be sent over a non-secure connection' do connection.on(:connected) { raise 'Should not have connected' } connection.on(:failed) do |error| - expect(error).to be_a(Ably::Exceptions::InsecureRequestError) + expect(error).to be_a(Ably::Exceptions::InsecureRequest) stop_reactor end end end end @@ -42,11 +42,11 @@ context 'token auth' do [true, false].each do |tls_enabled| context "with TLS #{tls_enabled ? 'enabled' : 'disabled'}" do let(:capability) { { :foo => ["publish"] } } - let(:token_details) { Ably::Realtime::Client.new(default_options).auth.request_token(capability: capability) } + let(:token_details) { Ably::Realtime::Client.new(default_options).auth.request_token_sync(capability: capability) } let(:client_options) { default_options.merge(token: token_details.token) } context 'and a pre-generated Token provided with the :token option' do it 'connects using token auth' do connection.on(:connected) do @@ -93,11 +93,11 @@ let(:auth) { subject.auth } subject do Ably::Realtime::Client.new(client_options.merge(auth_callback: Proc.new do @block_called = true - auth.create_token_request(client_id: client_id) + auth.create_token_request_sync(client_id: client_id) end)) end it 'calls the Proc' do connection.on(:connected) do @@ -111,9 +111,30 @@ expect(auth.current_token_details.client_id).to eql(client_id) stop_reactor end end end + end + end + + context '#connection' do + it 'provides access to the Connection object' do + expect(subject.connection).to be_a(Ably::Realtime::Connection) + stop_reactor + end + end + + context '#channels' do + it 'provides access to the Channels collection object' do + expect(subject.channels).to be_a(Ably::Realtime::Channels) + stop_reactor + end + end + + context '#auth' do + it 'provides access to the Realtime::Auth object' do + expect(subject.auth).to be_a(Ably::Realtime::Auth) + stop_reactor end end end end