ably-rest 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ably-rest.gemspec +2 -1
- data/lib/submodules/ably-ruby/.travis.yml +6 -4
- data/lib/submodules/ably-ruby/CHANGELOG.md +52 -61
- data/lib/submodules/ably-ruby/README.md +10 -0
- data/lib/submodules/ably-ruby/SPEC.md +1473 -852
- data/lib/submodules/ably-ruby/ably.gemspec +2 -1
- data/lib/submodules/ably-ruby/lib/ably/auth.rb +57 -25
- data/lib/submodules/ably-ruby/lib/ably/exceptions.rb +34 -8
- data/lib/submodules/ably-ruby/lib/ably/logger.rb +10 -1
- data/lib/submodules/ably-ruby/lib/ably/models/auth_details.rb +42 -0
- data/lib/submodules/ably-ruby/lib/ably/models/channel_state_change.rb +18 -4
- data/lib/submodules/ably-ruby/lib/ably/models/connection_details.rb +6 -3
- data/lib/submodules/ably-ruby/lib/ably/models/connection_state_change.rb +4 -3
- data/lib/submodules/ably-ruby/lib/ably/models/error_info.rb +1 -1
- data/lib/submodules/ably-ruby/lib/ably/models/message.rb +12 -1
- data/lib/submodules/ably-ruby/lib/ably/models/message_encoders/base.rb +101 -97
- data/lib/submodules/ably-ruby/lib/ably/models/presence_message.rb +13 -1
- data/lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb +20 -3
- data/lib/submodules/ably-ruby/lib/ably/modules/async_wrapper.rb +7 -3
- data/lib/submodules/ably-ruby/lib/ably/modules/enum.rb +17 -7
- data/lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb +29 -14
- data/lib/submodules/ably-ruby/lib/ably/modules/state_emitter.rb +7 -4
- data/lib/submodules/ably-ruby/lib/ably/modules/state_machine.rb +2 -4
- data/lib/submodules/ably-ruby/lib/ably/modules/uses_state_machine.rb +7 -3
- data/lib/submodules/ably-ruby/lib/ably/realtime.rb +2 -0
- data/lib/submodules/ably-ruby/lib/ably/realtime/auth.rb +79 -31
- data/lib/submodules/ably-ruby/lib/ably/realtime/channel.rb +62 -26
- data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb +154 -65
- data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_state_machine.rb +14 -15
- data/lib/submodules/ably-ruby/lib/ably/realtime/client.rb +16 -3
- data/lib/submodules/ably-ruby/lib/ably/realtime/client/incoming_message_dispatcher.rb +38 -29
- data/lib/submodules/ably-ruby/lib/ably/realtime/client/outgoing_message_dispatcher.rb +6 -1
- data/lib/submodules/ably-ruby/lib/ably/realtime/connection.rb +108 -49
- data/lib/submodules/ably-ruby/lib/ably/realtime/connection/connection_manager.rb +165 -59
- data/lib/submodules/ably-ruby/lib/ably/realtime/connection/connection_state_machine.rb +22 -3
- data/lib/submodules/ably-ruby/lib/ably/realtime/connection/websocket_transport.rb +19 -10
- data/lib/submodules/ably-ruby/lib/ably/realtime/presence.rb +67 -45
- data/lib/submodules/ably-ruby/lib/ably/realtime/presence/members_map.rb +198 -36
- data/lib/submodules/ably-ruby/lib/ably/realtime/presence/presence_manager.rb +30 -6
- data/lib/submodules/ably-ruby/lib/ably/realtime/presence/presence_state_machine.rb +5 -12
- data/lib/submodules/ably-ruby/lib/ably/rest/channel.rb +3 -3
- data/lib/submodules/ably-ruby/lib/ably/rest/client.rb +21 -8
- data/lib/submodules/ably-ruby/lib/ably/rest/middleware/exceptions.rb +1 -3
- data/lib/submodules/ably-ruby/lib/ably/rest/middleware/logger.rb +2 -2
- data/lib/submodules/ably-ruby/lib/ably/rest/presence.rb +1 -1
- data/lib/submodules/ably-ruby/lib/ably/util/pub_sub.rb +1 -1
- data/lib/submodules/ably-ruby/lib/ably/util/safe_deferrable.rb +26 -0
- data/lib/submodules/ably-ruby/lib/ably/version.rb +2 -2
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/auth_spec.rb +416 -99
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_history_spec.rb +5 -3
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb +1011 -160
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb +2 -2
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_failures_spec.rb +458 -27
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_spec.rb +436 -97
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/message_spec.rb +52 -23
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_history_spec.rb +5 -3
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb +1160 -105
- data/lib/submodules/ably-ruby/spec/acceptance/rest/auth_spec.rb +151 -22
- data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/acceptance/rest/client_spec.rb +88 -27
- data/lib/submodules/ably-ruby/spec/acceptance/rest/message_spec.rb +42 -15
- data/lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb +4 -4
- data/lib/submodules/ably-ruby/spec/rspec_config.rb +2 -1
- data/lib/submodules/ably-ruby/spec/shared/client_initializer_behaviour.rb +2 -2
- data/lib/submodules/ably-ruby/spec/shared/safe_deferrable_behaviour.rb +6 -2
- data/lib/submodules/ably-ruby/spec/support/debug_failure_helper.rb +20 -4
- data/lib/submodules/ably-ruby/spec/support/event_machine_helper.rb +32 -1
- data/lib/submodules/ably-ruby/spec/unit/auth_spec.rb +4 -11
- data/lib/submodules/ably-ruby/spec/unit/logger_spec.rb +28 -2
- data/lib/submodules/ably-ruby/spec/unit/models/auth_details_spec.rb +49 -0
- data/lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb +23 -3
- data/lib/submodules/ably-ruby/spec/unit/models/connection_details_spec.rb +12 -1
- data/lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb +15 -4
- data/lib/submodules/ably-ruby/spec/unit/models/message_spec.rb +34 -2
- data/lib/submodules/ably-ruby/spec/unit/models/presence_message_spec.rb +73 -2
- data/lib/submodules/ably-ruby/spec/unit/models/protocol_message_spec.rb +64 -6
- data/lib/submodules/ably-ruby/spec/unit/models/token_details_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/unit/models/token_request_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/unit/modules/async_wrapper_spec.rb +2 -1
- data/lib/submodules/ably-ruby/spec/unit/modules/enum_spec.rb +69 -0
- data/lib/submodules/ably-ruby/spec/unit/modules/event_emitter_spec.rb +149 -22
- data/lib/submodules/ably-ruby/spec/unit/modules/state_emitter_spec.rb +9 -3
- data/lib/submodules/ably-ruby/spec/unit/realtime/client_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/unit/realtime/connection_spec.rb +8 -5
- data/lib/submodules/ably-ruby/spec/unit/realtime/incoming_message_dispatcher_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/unit/realtime/presence_spec.rb +4 -3
- data/lib/submodules/ably-ruby/spec/unit/rest/client_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/unit/util/crypto_spec.rb +3 -3
- metadata +7 -5
|
@@ -83,13 +83,13 @@ describe Ably::Modules::EventEmitter do
|
|
|
83
83
|
allow(obj).to receive(:received_message)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
it 'is unaffected and processes the prior event callbacks once' do
|
|
86
|
+
it 'is unaffected and processes the prior event callbacks once (#RTE6b)' do
|
|
87
87
|
expect(obj).to receive(:received_message).with(msg).twice
|
|
88
88
|
expect(obj).to_not receive(:received_message_from_new_callbacks).with(msg)
|
|
89
89
|
subject.emit :message, msg
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
it 'adds them for the next emitted event' do
|
|
92
|
+
it 'adds them for the next emitted event (#RTE6b)' do
|
|
93
93
|
expect(obj).to receive(:received_message_from_new_callbacks).with(msg).twice
|
|
94
94
|
|
|
95
95
|
# New callbacks are added in this emit
|
|
@@ -110,12 +110,12 @@ describe Ably::Modules::EventEmitter do
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
it 'is unaffected and processes the prior event callbacks once' do
|
|
113
|
+
it 'is unaffected and processes the prior event callbacks once (#RTE6b)' do
|
|
114
114
|
expect(obj).to receive(:received_message).with(msg).twice
|
|
115
115
|
subject.emit :message, msg
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
it 'removes them for the next emitted event' do
|
|
118
|
+
it 'removes them for the next emitted event (#RTE6b)' do
|
|
119
119
|
expect(obj).to receive(:received_message).with(msg).twice
|
|
120
120
|
|
|
121
121
|
# Callbacks are removed in this emit
|
|
@@ -127,7 +127,7 @@ describe Ably::Modules::EventEmitter do
|
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
context '#on' do
|
|
130
|
+
context '#on (#RTE3)' do
|
|
131
131
|
context 'with event specified' do
|
|
132
132
|
it 'calls the block every time an event is emitted only' do
|
|
133
133
|
block_called = 0
|
|
@@ -137,7 +137,9 @@ describe Ably::Modules::EventEmitter do
|
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
140
|
-
expect(subject.logger).to receive(:error)
|
|
140
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
141
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Intentional exception/)
|
|
142
|
+
end
|
|
141
143
|
subject.on(:event) { raise 'Intentional exception' }
|
|
142
144
|
subject.emit :event
|
|
143
145
|
end
|
|
@@ -152,7 +154,9 @@ describe Ably::Modules::EventEmitter do
|
|
|
152
154
|
end
|
|
153
155
|
|
|
154
156
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
155
|
-
expect(subject.logger).to receive(:error)
|
|
157
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
158
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Intentional exception/)
|
|
159
|
+
end
|
|
156
160
|
subject.on { raise 'Intentional exception' }
|
|
157
161
|
subject.emit :event
|
|
158
162
|
end
|
|
@@ -173,7 +177,7 @@ describe Ably::Modules::EventEmitter do
|
|
|
173
177
|
end
|
|
174
178
|
end
|
|
175
179
|
|
|
176
|
-
context '#once' do
|
|
180
|
+
context '#once (#RTE4)' do
|
|
177
181
|
context 'with event specified' do
|
|
178
182
|
it 'calls the block the first time an event is emitted only' do
|
|
179
183
|
block_called = 0
|
|
@@ -191,7 +195,9 @@ describe Ably::Modules::EventEmitter do
|
|
|
191
195
|
end
|
|
192
196
|
|
|
193
197
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
194
|
-
expect(subject.logger).to receive(:error)
|
|
198
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
199
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Intentional exception/)
|
|
200
|
+
end
|
|
195
201
|
subject.once(:event) { raise 'Intentional exception' }
|
|
196
202
|
subject.emit :event
|
|
197
203
|
end
|
|
@@ -214,7 +220,9 @@ describe Ably::Modules::EventEmitter do
|
|
|
214
220
|
end
|
|
215
221
|
|
|
216
222
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
217
|
-
expect(subject.logger).to receive(:error)
|
|
223
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
224
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Intentional exception/)
|
|
225
|
+
end
|
|
218
226
|
subject.once { raise 'Intentional exception' }
|
|
219
227
|
subject.emit :event
|
|
220
228
|
end
|
|
@@ -248,12 +256,12 @@ describe Ably::Modules::EventEmitter do
|
|
|
248
256
|
end
|
|
249
257
|
|
|
250
258
|
context 'with event names as arguments' do
|
|
251
|
-
it 'deletes matching callbacks' do
|
|
259
|
+
it 'deletes matching callbacks when a block is provided' do
|
|
252
260
|
expect(obj).to_not receive(:received_message).with(msg)
|
|
253
261
|
subject.off(:message, &callback)
|
|
254
262
|
end
|
|
255
263
|
|
|
256
|
-
it 'deletes all callbacks
|
|
264
|
+
it 'deletes all matching callbacks when a block is not provided' do
|
|
257
265
|
expect(obj).to_not receive(:received_message).with(msg)
|
|
258
266
|
subject.off(:message)
|
|
259
267
|
end
|
|
@@ -277,18 +285,137 @@ describe Ably::Modules::EventEmitter do
|
|
|
277
285
|
end
|
|
278
286
|
end
|
|
279
287
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
288
|
+
context 'when on callback is configured for all events' do
|
|
289
|
+
before do
|
|
290
|
+
subject.on(&callback)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
after do
|
|
294
|
+
subject.emit :message, msg
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
context 'with event names as arguments' do
|
|
298
|
+
it 'does not remove the all events callback when a block is provided' do
|
|
299
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
300
|
+
subject.off(:message, &callback)
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
it 'does not remove the all events callback when a block is not provided' do
|
|
304
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
305
|
+
subject.off(:message)
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
it 'does not remove the all events callback when the block does not match' do
|
|
309
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
310
|
+
subject.off(:message) { true }
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
context 'without any event names' do
|
|
315
|
+
it 'deletes all matching callbacks' do
|
|
316
|
+
expect(obj).to_not receive(:received_message).with(msg)
|
|
317
|
+
subject.off(&callback)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
it 'deletes all callbacks if not block given' do
|
|
321
|
+
expect(obj).to_not receive(:received_message).with(msg)
|
|
322
|
+
subject.off
|
|
323
|
+
end
|
|
324
|
+
end
|
|
285
325
|
end
|
|
286
326
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
327
|
+
context 'with unsafe_on subscribers' do
|
|
328
|
+
before do
|
|
329
|
+
subject.unsafe_on(&callback)
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
after do
|
|
333
|
+
subject.emit :message, msg
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
it 'does not deregister them' do
|
|
337
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
338
|
+
subject.off
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
context 'with unsafe_once subscribers' do
|
|
343
|
+
before do
|
|
344
|
+
subject.unsafe_once(&callback)
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
after do
|
|
348
|
+
subject.emit :message, msg
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it 'does not deregister them' do
|
|
352
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
353
|
+
subject.off
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
context '#unsafe_off' do
|
|
359
|
+
let(:callback) { Proc.new { |msg| obj.received_message msg } }
|
|
360
|
+
|
|
361
|
+
context 'with unsafe_on subscribers' do
|
|
362
|
+
before do
|
|
363
|
+
subject.unsafe_on(&callback)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
after do
|
|
367
|
+
subject.emit :message, msg
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
it 'deregisters them' do
|
|
371
|
+
expect(obj).to_not receive(:received_message).with(msg)
|
|
372
|
+
subject.unsafe_off
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
context 'with unsafe_once subscribers' do
|
|
377
|
+
before do
|
|
378
|
+
subject.unsafe_once(&callback)
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
after do
|
|
382
|
+
subject.emit :message, msg
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
it 'deregister them' do
|
|
386
|
+
expect(obj).to_not receive(:received_message).with(msg)
|
|
387
|
+
subject.unsafe_off
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
context 'with on subscribers' do
|
|
392
|
+
before do
|
|
393
|
+
subject.on(&callback)
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
after do
|
|
397
|
+
subject.emit :message, msg
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
it 'does not deregister them' do
|
|
401
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
402
|
+
subject.unsafe_off
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
context 'with once subscribers' do
|
|
407
|
+
before do
|
|
408
|
+
subject.once(&callback)
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
after do
|
|
412
|
+
subject.emit :message, msg
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
it 'does not deregister them' do
|
|
416
|
+
expect(obj).to receive(:received_message).with(msg)
|
|
417
|
+
subject.unsafe_off
|
|
418
|
+
end
|
|
292
419
|
end
|
|
293
420
|
end
|
|
294
421
|
end
|
|
@@ -269,14 +269,18 @@ describe Ably::Modules::StateEmitter do
|
|
|
269
269
|
|
|
270
270
|
context 'success block' do
|
|
271
271
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
272
|
-
expect(subject.logger).to receive(:error)
|
|
272
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
273
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Success exception/)
|
|
274
|
+
end
|
|
273
275
|
subject.change_state target_state
|
|
274
276
|
end
|
|
275
277
|
end
|
|
276
278
|
|
|
277
279
|
context 'failure block' do
|
|
278
280
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
279
|
-
expect(subject.logger).to receive(:error)
|
|
281
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
282
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Failure exception/)
|
|
283
|
+
end
|
|
280
284
|
subject.change_state :connecting
|
|
281
285
|
end
|
|
282
286
|
end
|
|
@@ -343,7 +347,9 @@ describe Ably::Modules::StateEmitter do
|
|
|
343
347
|
|
|
344
348
|
it 'catches exceptions in the provided block, logs the error and continues' do
|
|
345
349
|
subject.once_state_changed { raise 'Intentional exception' }
|
|
346
|
-
expect(subject.logger).to receive(:error)
|
|
350
|
+
expect(subject.logger).to receive(:error) do |*args, &block|
|
|
351
|
+
expect(args.concat([block ? block.call : nil]).join(',')).to match(/Intentional exception/)
|
|
352
|
+
end
|
|
347
353
|
subject.change_state :connected
|
|
348
354
|
end
|
|
349
355
|
end
|
|
@@ -14,7 +14,7 @@ describe Ably::Realtime::Client do
|
|
|
14
14
|
|
|
15
15
|
it 'passes on the options to the initializer' do
|
|
16
16
|
rest_client = instance_double('Ably::Rest::Client', auth: instance_double('Ably::Auth'), options: client_options)
|
|
17
|
-
expect(Ably::Rest::Client).to receive(:new).with(client_options).and_return(rest_client)
|
|
17
|
+
expect(Ably::Rest::Client).to receive(:new).with(hash_including(client_options)).and_return(rest_client)
|
|
18
18
|
subject
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -5,7 +5,10 @@ describe Ably::Realtime::Connection do
|
|
|
5
5
|
let(:client) { instance_double('Ably::Realtime::Client', logger: double('logger').as_null_object) }
|
|
6
6
|
|
|
7
7
|
subject do
|
|
8
|
-
Ably::Realtime::Connection.new(client, {})
|
|
8
|
+
Ably::Realtime::Connection.new(client, {}).tap do |connection|
|
|
9
|
+
connection.__incoming_protocol_msgbus__.unsubscribe
|
|
10
|
+
connection.__outgoing_protocol_msgbus__.unsubscribe
|
|
11
|
+
end
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
before do
|
|
@@ -34,10 +37,10 @@ describe Ably::Realtime::Connection do
|
|
|
34
37
|
describe 'connection resume callbacks', api_private: true do
|
|
35
38
|
let(:callbacks) { [] }
|
|
36
39
|
|
|
37
|
-
describe '#
|
|
40
|
+
describe '#trigger_resumed' do
|
|
38
41
|
it 'executes the callbacks' do
|
|
39
42
|
subject.on_resume { callbacks << true }
|
|
40
|
-
subject.
|
|
43
|
+
subject.trigger_resumed
|
|
41
44
|
expect(callbacks.count).to eql(1)
|
|
42
45
|
end
|
|
43
46
|
end
|
|
@@ -45,7 +48,7 @@ describe Ably::Realtime::Connection do
|
|
|
45
48
|
describe '#on_resume' do
|
|
46
49
|
it 'registers a callback' do
|
|
47
50
|
subject.on_resume { callbacks << true }
|
|
48
|
-
subject.
|
|
51
|
+
subject.trigger_resumed
|
|
49
52
|
expect(callbacks.count).to eql(1)
|
|
50
53
|
end
|
|
51
54
|
end
|
|
@@ -55,7 +58,7 @@ describe Ably::Realtime::Connection do
|
|
|
55
58
|
subject.on_resume { callbacks << true }
|
|
56
59
|
additional_proc = proc { raise 'This should not be called' }
|
|
57
60
|
subject.off_resume(&additional_proc)
|
|
58
|
-
subject.
|
|
61
|
+
subject.trigger_resumed
|
|
59
62
|
expect(callbacks.count).to eql(1)
|
|
60
63
|
end
|
|
61
64
|
end
|
|
@@ -5,7 +5,7 @@ describe Ably::Realtime::Client::IncomingMessageDispatcher, :api_private do
|
|
|
5
5
|
Ably::Util::PubSub.new
|
|
6
6
|
end
|
|
7
7
|
let(:connection) do
|
|
8
|
-
instance_double('Ably::Realtime::Connection', __incoming_protocol_msgbus__: msgbus, configure_new: true, id: nil)
|
|
8
|
+
instance_double('Ably::Realtime::Connection', __incoming_protocol_msgbus__: msgbus, configure_new: true, id: nil, set_connection_confirmed_alive: nil)
|
|
9
9
|
end
|
|
10
10
|
let(:client) do
|
|
11
11
|
instance_double('Ably::Realtime::Client', channels: {})
|
|
@@ -48,14 +48,15 @@ describe Ably::Realtime::Presence do
|
|
|
48
48
|
context 'subscriptions' do
|
|
49
49
|
let(:message_history) { Hash.new { |hash, key| hash[key] = 0 } }
|
|
50
50
|
let(:enter_action) { Ably::Models::PresenceMessage::ACTION.Enter }
|
|
51
|
+
let(:clone) { instance_double('Ably::Models::PresenceMessage', member_key: random_str, connection_id: random_str) }
|
|
51
52
|
let(:enter_message) do
|
|
52
|
-
instance_double('Ably::Models::PresenceMessage', action: enter_action, connection_id: random_str, decode: true, member_key: random_str)
|
|
53
|
+
instance_double('Ably::Models::PresenceMessage', action: enter_action, connection_id: random_str, decode: true, member_key: random_str, shallow_clone: clone)
|
|
53
54
|
end
|
|
54
55
|
let(:leave_message) do
|
|
55
|
-
instance_double('Ably::Models::PresenceMessage', action: Ably::Models::PresenceMessage::ACTION.Leave, connection_id: random_str, decode: true, member_key: random_str)
|
|
56
|
+
instance_double('Ably::Models::PresenceMessage', action: Ably::Models::PresenceMessage::ACTION.Leave, connection_id: random_str, decode: true, member_key: random_str, shallow_clone: clone)
|
|
56
57
|
end
|
|
57
58
|
let(:update_message) do
|
|
58
|
-
instance_double('Ably::Models::PresenceMessage', action: Ably::Models::PresenceMessage::ACTION.Update, connection_id: random_str, decode: true, member_key: random_str)
|
|
59
|
+
instance_double('Ably::Models::PresenceMessage', action: Ably::Models::PresenceMessage::ACTION.Update, connection_id: random_str, decode: true, member_key: random_str, shallow_clone: clone)
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
context '#subscribe' do
|
|
@@ -14,7 +14,7 @@ describe Ably::Rest::Client do
|
|
|
14
14
|
context 'disabled' do
|
|
15
15
|
let(:client_options) { { key: 'appid.keyuid:keysecret', tls: false } }
|
|
16
16
|
|
|
17
|
-
it 'fails for any operation with basic auth and attempting to send an API key over a non-secure connection' do
|
|
17
|
+
it 'fails for any operation with basic auth and attempting to send an API key over a non-secure connection (#RSA1)' do
|
|
18
18
|
expect { subject.channel('a').publish('event', 'message') }.to raise_error(Ably::Exceptions::InsecureRequest)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -100,7 +100,7 @@ describe Ably::Util::Crypto do
|
|
|
100
100
|
let(:encryption_data_128) { JSON.parse(File.read(File.join(resources_root, 'crypto-data-128.json'))) }
|
|
101
101
|
let(:encryption_data_256) { JSON.parse(File.read(File.join(resources_root, 'crypto-data-256.json'))) }
|
|
102
102
|
|
|
103
|
-
shared_examples 'an Ably encrypter and decrypter' do
|
|
103
|
+
shared_examples 'an Ably encrypter and decrypter (#RTL7d)' do
|
|
104
104
|
let(:algorithm) { data['algorithm'].upcase }
|
|
105
105
|
let(:mode) { data['mode'].upcase }
|
|
106
106
|
let(:key_length) { data['keylength'] }
|
|
@@ -126,13 +126,13 @@ describe Ably::Util::Crypto do
|
|
|
126
126
|
context 'with AES-128-CBC' do
|
|
127
127
|
let(:data) { encryption_data_128 }
|
|
128
128
|
|
|
129
|
-
it_behaves_like 'an Ably encrypter and decrypter'
|
|
129
|
+
it_behaves_like 'an Ably encrypter and decrypter (#RTL7d)'
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
context 'with AES-256-CBC' do
|
|
133
133
|
let(:data) { encryption_data_256 }
|
|
134
134
|
|
|
135
|
-
it_behaves_like 'an Ably encrypter and decrypter'
|
|
135
|
+
it_behaves_like 'an Ably encrypter and decrypter (#RTL7d)'
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ably-rest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew O'Riordan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -156,14 +156,14 @@ dependencies:
|
|
|
156
156
|
requirements:
|
|
157
157
|
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '2.
|
|
159
|
+
version: '2.2'
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: '2.
|
|
166
|
+
version: '2.2'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: coveralls
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -242,6 +242,7 @@ files:
|
|
|
242
242
|
- lib/submodules/ably-ruby/lib/ably/auth.rb
|
|
243
243
|
- lib/submodules/ably-ruby/lib/ably/exceptions.rb
|
|
244
244
|
- lib/submodules/ably-ruby/lib/ably/logger.rb
|
|
245
|
+
- lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
|
|
245
246
|
- lib/submodules/ably-ruby/lib/ably/models/channel_state_change.rb
|
|
246
247
|
- lib/submodules/ably-ruby/lib/ably/models/cipher_params.rb
|
|
247
248
|
- lib/submodules/ably-ruby/lib/ably/models/connection_details.rb
|
|
@@ -354,6 +355,7 @@ files:
|
|
|
354
355
|
- lib/submodules/ably-ruby/spec/support/test_app.rb
|
|
355
356
|
- lib/submodules/ably-ruby/spec/unit/auth_spec.rb
|
|
356
357
|
- lib/submodules/ably-ruby/spec/unit/logger_spec.rb
|
|
358
|
+
- lib/submodules/ably-ruby/spec/unit/models/auth_details_spec.rb
|
|
357
359
|
- lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
|
|
358
360
|
- lib/submodules/ably-ruby/spec/unit/models/cipher_params_spec.rb
|
|
359
361
|
- lib/submodules/ably-ruby/spec/unit/models/connection_details_spec.rb
|
|
@@ -419,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
419
421
|
version: '0'
|
|
420
422
|
requirements: []
|
|
421
423
|
rubyforge_project:
|
|
422
|
-
rubygems_version: 2.4.
|
|
424
|
+
rubygems_version: 2.4.8
|
|
423
425
|
signing_key:
|
|
424
426
|
specification_version: 4
|
|
425
427
|
summary: A Ruby REST only client library for ably.io realtime messaging
|