spec/unit/rest/client_spec.rb in ably-1.0.7 vs spec/unit/rest/client_spec.rb in ably-1.1.0

- old
+ new

@@ -18,10 +18,28 @@ expect { subject.channel('a').publish('event', 'message') }.to raise_error(Ably::Exceptions::InsecureRequest) end end end + context 'fallback_retry_timeout (#RSC15f)' do + context 'default' do + let(:client_options) { { key: 'appid.keyuid:keysecret' } } + + it 'is set to 10 minutes' do + expect(subject.options.fetch(:fallback_retry_timeout)).to eql(10 * 60) + end + end + + context 'when provided' do + let(:client_options) { { key: 'appid.keyuid:keysecret', fallback_retry_timeout: 30 } } + + it 'configures a new timeout' do + expect(subject.options.fetch(:fallback_retry_timeout)).to eql(30) + end + end + end + context ':use_token_auth' do context 'set to false' do context 'with a key and :tls => false' do let(:client_options) { { use_token_auth: false, key: 'appid.keyuid:keysecret', tls: false } } @@ -53,8 +71,20 @@ context 'request_id generation' do let(:client_options) { { key: 'appid.keyuid:keysecret', add_request_ids: true } } it 'includes request_id in URL' do expect(subject.add_request_ids).to eql(true) + end + end + + context 'push' do + let(:client_options) { { key: 'appid.keyuid:keysecret' } } + + specify '#device is not supported and raises an exception' do + expect { subject.device }.to raise_error Ably::Exceptions::PushNotificationsNotSupported + end + + specify '#push returns a Push object' do + expect(subject.push).to be_a(Ably::Rest::Push) end end end