Sha256: 8c4ba4824059ce5de4ca7bd08a46da0a817fc26beff083382a9637b55830415f
Contents?: true
Size: 1.19 KB
Versions: 64
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe Ably::Realtime::Client, '#time', :event_machine do vary_by_protocol do let(:client) do auto_close Ably::Realtime::Client.new(key: api_key, environment: environment, protocol: protocol) end describe 'fetching the service time' do it 'should return the service time as a Time object' do run_reactor do client.time do |time| expect(time).to be_within(2).of(Time.now) stop_reactor end end end it 'returns a SafeDeferrable that catches exceptions in callbacks and logs them' do run_reactor do expect(client.time).to be_a(Ably::Util::SafeDeferrable) stop_reactor end end context 'with reconfigured HTTP timeout' do let(:client) do auto_close Ably::Realtime::Client.new(http_request_timeout: 0.0001, key: api_key, environment: environment, protocol: protocol, log_level: :fatal) end it 'should raise a timeout exception' do client.time.errback do |error| expect(error).to be_a Ably::Exceptions::ConnectionTimeout stop_reactor end end end end end end
Version data entries
64 entries across 64 versions & 2 rubygems