ably-rest 0.8.1 → 0.8.2

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.
Files changed (55) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG.md +45 -0
  3. data/LICENSE +15 -0
  4. data/README.md +14 -1
  5. data/lib/submodules/ably-ruby/CHANGELOG.md +45 -0
  6. data/lib/submodules/ably-ruby/LICENSE +15 -0
  7. data/lib/submodules/ably-ruby/README.md +18 -14
  8. data/lib/submodules/ably-ruby/SPEC.md +482 -336
  9. data/lib/submodules/ably-ruby/ably.gemspec +1 -1
  10. data/lib/submodules/ably-ruby/lib/ably.rb +1 -1
  11. data/lib/submodules/ably-ruby/lib/ably/exceptions.rb +4 -1
  12. data/lib/submodules/ably-ruby/lib/ably/models/{paginated_resource.rb → paginated_result.rb} +8 -8
  13. data/lib/submodules/ably-ruby/lib/ably/models/presence_message.rb +1 -1
  14. data/lib/submodules/ably-ruby/lib/ably/modules/conversions.rb +15 -0
  15. data/lib/submodules/ably-ruby/lib/ably/modules/encodeable.rb +2 -2
  16. data/lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb +8 -8
  17. data/lib/submodules/ably-ruby/lib/ably/modules/safe_deferrable.rb +15 -3
  18. data/lib/submodules/ably-ruby/lib/ably/modules/state_emitter.rb +2 -2
  19. data/lib/submodules/ably-ruby/lib/ably/modules/state_machine.rb +1 -1
  20. data/lib/submodules/ably-ruby/lib/ably/realtime/channel.rb +2 -4
  21. data/lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb +1 -1
  22. data/lib/submodules/ably-ruby/lib/ably/realtime/client.rb +4 -4
  23. data/lib/submodules/ably-ruby/lib/ably/realtime/client/incoming_message_dispatcher.rb +2 -2
  24. data/lib/submodules/ably-ruby/lib/ably/realtime/connection.rb +2 -2
  25. data/lib/submodules/ably-ruby/lib/ably/realtime/connection/connection_manager.rb +3 -3
  26. data/lib/submodules/ably-ruby/lib/ably/realtime/connection/connection_state_machine.rb +1 -1
  27. data/lib/submodules/ably-ruby/lib/ably/realtime/connection/websocket_transport.rb +2 -2
  28. data/lib/submodules/ably-ruby/lib/ably/realtime/presence.rb +23 -5
  29. data/lib/submodules/ably-ruby/lib/ably/realtime/presence/members_map.rb +16 -13
  30. data/lib/submodules/ably-ruby/lib/ably/rest/channel.rb +3 -2
  31. data/lib/submodules/ably-ruby/lib/ably/rest/client.rb +2 -2
  32. data/lib/submodules/ably-ruby/lib/ably/rest/presence.rb +4 -4
  33. data/lib/submodules/ably-ruby/lib/ably/util/pub_sub.rb +1 -1
  34. data/lib/submodules/ably-ruby/lib/ably/util/safe_deferrable.rb +1 -1
  35. data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -1
  36. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_history_spec.rb +1 -1
  37. data/lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb +5 -15
  38. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_failures_spec.rb +2 -2
  39. data/lib/submodules/ably-ruby/spec/acceptance/realtime/connection_spec.rb +16 -14
  40. data/lib/submodules/ably-ruby/spec/acceptance/realtime/message_spec.rb +91 -8
  41. data/lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb +190 -71
  42. data/lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb +2 -2
  43. data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +1 -1
  44. data/lib/submodules/ably-ruby/spec/acceptance/rest/encoders_spec.rb +1 -1
  45. data/lib/submodules/ably-ruby/spec/acceptance/rest/message_spec.rb +73 -1
  46. data/lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb +4 -2
  47. data/lib/submodules/ably-ruby/spec/unit/models/{paginated_resource_spec.rb → paginated_result_spec.rb} +18 -18
  48. data/lib/submodules/ably-ruby/spec/unit/modules/event_emitter_spec.rb +27 -27
  49. data/lib/submodules/ably-ruby/spec/unit/modules/state_emitter_spec.rb +1 -1
  50. data/lib/submodules/ably-ruby/spec/unit/realtime/channel_spec.rb +2 -2
  51. data/lib/submodules/ably-ruby/spec/unit/realtime/connection_spec.rb +3 -3
  52. data/lib/submodules/ably-ruby/spec/unit/realtime/presence_spec.rb +2 -2
  53. metadata +35 -33
  54. data/LICENSE.txt +0 -22
  55. data/lib/submodules/ably-ruby/LICENSE.txt +0 -22
@@ -53,6 +53,107 @@ describe Ably::Realtime::Presence, :event_machine do
53
53
  end
54
54
  end
55
55
 
56
+ context 'with supported data payload content type' do
57
+ def register_presence_and_check_data(method_name, data)
58
+ if method_name.to_s.match(/_client/)
59
+ presence_client_one.public_send(method_name, 'client_id', data: data)
60
+ else
61
+ presence_client_one.public_send(method_name, data: data)
62
+ end
63
+
64
+ presence_client_one.subscribe do |presence_message|
65
+ expect(presence_message.data).to eql(data)
66
+ stop_reactor
67
+ end
68
+ end
69
+
70
+ context 'JSON Object (Hash)' do
71
+ let(:data) { { 'Hash' => 'true' } }
72
+
73
+ it 'is encoded and decoded to the same hash' do
74
+ setup_test(method_name, args, options) do
75
+ register_presence_and_check_data method_name, data
76
+ end
77
+ end
78
+ end
79
+
80
+ context 'JSON Array' do
81
+ let(:data) { [ nil, true, false, 55, 'string', { 'Hash' => true }, ['array'] ] }
82
+
83
+ it 'is encoded and decoded to the same Array' do
84
+ setup_test(method_name, args, options) do
85
+ register_presence_and_check_data method_name, data
86
+ end
87
+ end
88
+ end
89
+
90
+ context 'String' do
91
+ let(:data) { random_str }
92
+
93
+ it 'is encoded and decoded to the same Array' do
94
+ setup_test(method_name, args, options) do
95
+ register_presence_and_check_data method_name, data
96
+ end
97
+ end
98
+ end
99
+
100
+ context 'Binary' do
101
+ let(:data) { Base64.encode64(random_str) }
102
+
103
+ it 'is encoded and decoded to the same Array' do
104
+ setup_test(method_name, args, options) do
105
+ register_presence_and_check_data method_name, data
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+ context 'with unsupported data payload content type' do
112
+ def presence_action(method_name, data)
113
+ if method_name.to_s.match(/_client/)
114
+ presence_client_one.public_send(method_name, 'client_id', data: data)
115
+ else
116
+ presence_client_one.public_send(method_name, data: data)
117
+ end
118
+ end
119
+
120
+ context 'Integer' do
121
+ let(:data) { 1 }
122
+
123
+ it 'raises an UnsupportedDataTypeError 40011 exception' do
124
+ expect { presence_action(method_name, data) }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
125
+ stop_reactor
126
+ end
127
+ end
128
+
129
+ context 'Float' do
130
+ let(:data) { 1.1 }
131
+
132
+ it 'raises an UnsupportedDataTypeError 40011 exception' do
133
+ expect { presence_action(method_name, data) }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
134
+ stop_reactor
135
+ end
136
+ end
137
+
138
+ context 'Boolean' do
139
+ let(:data) { true }
140
+
141
+ it 'raises an UnsupportedDataTypeError 40011 exception' do
142
+ expect { presence_action(method_name, data) }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
143
+ stop_reactor
144
+ end
145
+ end
146
+
147
+ context 'False' do
148
+ let(:data) { false }
149
+
150
+ it 'raises an UnsupportedDataTypeError 40011 exception' do
151
+ expect { presence_action(method_name, data) }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
152
+ stop_reactor
153
+ end
154
+ end
155
+ end
156
+
56
157
  it 'returns a SafeDeferrable that catches exceptions in callbacks and logs them' do
57
158
  setup_test(method_name, args, options) do
58
159
  expect(presence_client_one.public_send(method_name, args)).to be_a(Ably::Util::SafeDeferrable)
@@ -153,13 +254,15 @@ describe Ably::Realtime::Presence, :event_machine do
153
254
  stop_reactor
154
255
  end
155
256
 
156
- it 'will trigger an :in_sync event when synchronisation is complete' do
257
+ it 'will emit an :in_sync event when synchronisation is complete' do
157
258
  presence_client_one.enter
158
259
  presence_client_two.enter
159
260
 
160
261
  presence_anonymous_client.members.once(:in_sync) do
161
262
  stop_reactor
162
263
  end
264
+
265
+ channel_anonymous_client.attach
163
266
  end
164
267
 
165
268
  context 'before server sync complete' do
@@ -180,6 +283,8 @@ describe Ably::Realtime::Presence, :event_machine do
180
283
  expect(member_ids.uniq.count).to eql(2)
181
284
  stop_reactor
182
285
  end
286
+
287
+ channel_anonymous_client.attach
183
288
  end
184
289
  end
185
290
  end
@@ -200,7 +305,7 @@ describe Ably::Realtime::Presence, :event_machine do
200
305
  presence_client_one.enter do
201
306
  channel_anonymous_client.attach do
202
307
  expect(channel_anonymous_client.presence).to_not be_sync_complete
203
- channel_anonymous_client.presence.get do
308
+ channel_anonymous_client.presence.get(wait_for_sync: true) do
204
309
  expect(channel_anonymous_client.presence).to be_sync_complete
205
310
  stop_reactor
206
311
  end
@@ -319,7 +424,7 @@ describe Ably::Realtime::Presence, :event_machine do
319
424
  end
320
425
  end
321
426
 
322
- it 'does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get' do
427
+ it 'does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get with :wait_for_sync' do
323
428
  left_client = 10
324
429
  left_client_id = "client:#{left_client}"
325
430
 
@@ -341,7 +446,7 @@ describe Ably::Realtime::Presence, :event_machine do
341
446
  member_left_emitted = true
342
447
  end
343
448
 
344
- presence_anonymous_client.get do |members|
449
+ presence_anonymous_client.get(wait_for_sync: true) do |members|
345
450
  expect(members.count).to eql(enter_expected_count - 1)
346
451
  expect(member_left_emitted).to eql(true)
347
452
  expect(members.map(&:client_id)).to_not include(left_client_id)
@@ -365,43 +470,40 @@ describe Ably::Realtime::Presence, :event_machine do
365
470
  end
366
471
 
367
472
  context '#get' do
368
- it 'waits until sync is complete', event_machine: 15 do
369
- enter_expected_count.times do |index|
370
- presence_client_one.enter_client("client:#{index}") do |message|
371
- entered << message
372
- next unless entered.count == enter_expected_count
373
-
374
- presence_anonymous_client.get do |members|
375
- expect(members.map(&:client_id).uniq.count).to eql(enter_expected_count)
376
- expect(members.count).to eql(enter_expected_count)
377
- stop_reactor
473
+ context 'with :wait_for_sync option set to true' do
474
+ it 'waits until sync is complete', event_machine: 15 do
475
+ enter_expected_count.times do |index|
476
+ presence_client_one.enter_client("client:#{index}") do |message|
477
+ entered << message
478
+ next unless entered.count == enter_expected_count
479
+
480
+ presence_anonymous_client.get(wait_for_sync: true) do |members|
481
+ expect(members.map(&:client_id).uniq.count).to eql(enter_expected_count)
482
+ expect(members.count).to eql(enter_expected_count)
483
+ stop_reactor
484
+ end
378
485
  end
379
486
  end
380
487
  end
381
488
  end
382
- end
383
- end
384
- end
385
- end
386
489
 
387
- context 'automatic attachment of channel on access to presence object' do
388
- it 'is implicit if presence state is initialized' do
389
- channel_client_one.presence
390
- channel_client_one.on(:attached) do
391
- expect(channel_client_one.state).to eq(:attached)
392
- stop_reactor
393
- end
394
- end
395
-
396
- it 'is disabled if presence state is not initialized' do
397
- channel_client_one.attach do
398
- channel_client_one.detach do
399
- expect(channel_client_one.state).to eq(:detached)
400
-
401
- channel_client_one.presence # access the presence object
402
- EventMachine.add_timer(1) do
403
- expect(channel_client_one.state).to eq(:detached)
404
- stop_reactor
490
+ context 'by default' do
491
+ it 'it does not wait for sync', event_machine: 15 do
492
+ enter_expected_count.times do |index|
493
+ presence_client_one.enter_client("client:#{index}") do |message|
494
+ entered << message
495
+ next unless entered.count == enter_expected_count
496
+
497
+ channel_anonymous_client.attach do
498
+ presence_anonymous_client.get do |members|
499
+ expect(presence_anonymous_client.members).to_not be_in_sync
500
+ expect(members.count).to eql(0)
501
+ stop_reactor
502
+ end
503
+ end
504
+ end
505
+ end
506
+ end
405
507
  end
406
508
  end
407
509
  end
@@ -571,7 +673,7 @@ describe Ably::Realtime::Presence, :event_machine do
571
673
  end
572
674
 
573
675
  context 'when set to nil' do
574
- it 'emits the previously defined value as a convenience' do
676
+ it 'emits a nil value for the data attribute when leaving' do
575
677
  presence_client_one.enter data: enter_data do
576
678
  presence_client_one.leave data: nil
577
679
  end
@@ -595,6 +697,22 @@ describe Ably::Realtime::Presence, :event_machine do
595
697
  end
596
698
  end
597
699
  end
700
+
701
+ context 'and sync is complete' do
702
+ it 'does not cache members that have left' do
703
+ presence_client_one.enter data: enter_data do
704
+ expect(presence_client_one.members).to be_in_sync
705
+ expect(presence_client_one.members.send(:members).count).to eql(1)
706
+ presence_client_one.leave data: data
707
+ end
708
+
709
+ presence_client_one.subscribe(:leave) do |presence_message|
710
+ expect(presence_message.data).to eql(data)
711
+ expect(presence_client_one.members.send(:members).count).to eql(0)
712
+ stop_reactor
713
+ end
714
+ end
715
+ end
598
716
  end
599
717
 
600
718
  it 'raises an exception if not entered' do
@@ -911,43 +1029,45 @@ describe Ably::Realtime::Presence, :event_machine do
911
1029
  )
912
1030
  end
913
1031
 
914
- it 'fails if the connection fails' do
915
- when_all(*connect_members_deferrables) do
916
- channel_client_two.attach do
917
- client_two.connection.transport.__incoming_protocol_msgbus__.subscribe(:protocol_message) do |protocol_message|
918
- if protocol_message.action == :sync
919
- sync_pages_received << protocol_message
920
- force_connection_failure client_two if sync_pages_received.count == 1
1032
+ context 'when :wait_for_sync is true' do
1033
+ it 'fails if the connection fails' do
1034
+ when_all(*connect_members_deferrables) do
1035
+ channel_client_two.attach do
1036
+ client_two.connection.transport.__incoming_protocol_msgbus__.subscribe(:protocol_message) do |protocol_message|
1037
+ if protocol_message.action == :sync
1038
+ sync_pages_received << protocol_message
1039
+ force_connection_failure client_two if sync_pages_received.count == 1
1040
+ end
921
1041
  end
922
1042
  end
923
- end
924
1043
 
925
- presence_client_two.get.tap do |deferrable|
926
- deferrable.callback { raise 'Get should not succeed' }
927
- deferrable.errback do |error|
928
- stop_reactor
1044
+ presence_client_two.get(wait_for_sync: true).tap do |deferrable|
1045
+ deferrable.callback { raise 'Get should not succeed' }
1046
+ deferrable.errback do |error|
1047
+ stop_reactor
1048
+ end
929
1049
  end
930
1050
  end
931
1051
  end
932
- end
933
1052
 
934
- it 'fails if the channel is detached' do
935
- when_all(*connect_members_deferrables) do
936
- channel_client_two.attach do
937
- client_two.connection.transport.__incoming_protocol_msgbus__.subscribe(:protocol_message) do |protocol_message|
938
- if protocol_message.action == :sync
939
- # prevent any more SYNC messages coming through
940
- client_two.connection.transport.__incoming_protocol_msgbus__.unsubscribe
941
- channel_client_two.change_state :detaching
942
- channel_client_two.change_state :detached
1053
+ it 'fails if the channel is detached' do
1054
+ when_all(*connect_members_deferrables) do
1055
+ channel_client_two.attach do
1056
+ client_two.connection.transport.__incoming_protocol_msgbus__.subscribe(:protocol_message) do |protocol_message|
1057
+ if protocol_message.action == :sync
1058
+ # prevent any more SYNC messages coming through
1059
+ client_two.connection.transport.__incoming_protocol_msgbus__.unsubscribe
1060
+ channel_client_two.change_state :detaching
1061
+ channel_client_two.change_state :detached
1062
+ end
943
1063
  end
944
1064
  end
945
- end
946
1065
 
947
- presence_client_two.get.tap do |deferrable|
948
- deferrable.callback { raise 'Get should not succeed' }
949
- deferrable.errback do |error|
950
- stop_reactor
1066
+ presence_client_two.get(wait_for_sync: true).tap do |deferrable|
1067
+ deferrable.callback { raise 'Get should not succeed' }
1068
+ deferrable.errback do |error|
1069
+ stop_reactor
1070
+ end
951
1071
  end
952
1072
  end
953
1073
  end
@@ -1059,12 +1179,12 @@ describe Ably::Realtime::Presence, :event_machine do
1059
1179
  end
1060
1180
 
1061
1181
  wait_until(proc { clients_entered[:client_one] + clients_entered[:client_two] == total_members * 2 }) do
1062
- presence_anonymous_client.get do |anonymous_members|
1182
+ presence_anonymous_client.get(wait_for_sync: true) do |anonymous_members|
1063
1183
  expect(anonymous_members.count).to eq(total_members)
1064
1184
  expect(anonymous_members.map(&:client_id).uniq.count).to eq(total_members)
1065
1185
 
1066
- presence_client_one.get do |client_one_members|
1067
- presence_client_two.get do |client_two_members|
1186
+ presence_client_one.get(wait_for_sync: true) do |client_one_members|
1187
+ presence_client_two.get(wait_for_sync: true) do |client_two_members|
1068
1188
  expect(client_one_members.count).to eq(total_members)
1069
1189
  expect(client_one_members.count).to eq(client_two_members.count)
1070
1190
  stop_reactor
@@ -1319,7 +1439,7 @@ describe Ably::Realtime::Presence, :event_machine do
1319
1439
 
1320
1440
  specify 'expect :left event with client data from enter event' do
1321
1441
  presence_client_one.subscribe(:leave) do |message|
1322
- presence_client_one.get do |members|
1442
+ presence_client_one.get(wait_for_sync: true) do |members|
1323
1443
  expect(members.count).to eq(0)
1324
1444
  expect(message.data).to eql(data_payload)
1325
1445
  stop_reactor
@@ -1335,8 +1455,7 @@ describe Ably::Realtime::Presence, :event_machine do
1335
1455
  let(:members_count) { 400 }
1336
1456
  let(:sync_pages_received) { [] }
1337
1457
 
1338
- # Will re-enable once https://github.com/ably/realtime/issues/91 is resolved
1339
- skip 'resumes the SYNC operation', em_timeout: 15 do
1458
+ it 'resumes the SYNC operation', em_timeout: 15 do
1340
1459
  when_all(*members_count.times.map do |index|
1341
1460
  presence_client_one.enter_client("client:#{index}")
1342
1461
  end) do
@@ -1349,7 +1468,7 @@ describe Ably::Realtime::Presence, :event_machine do
1349
1468
  end
1350
1469
  end
1351
1470
 
1352
- presence_client_two.get do |members|
1471
+ presence_client_two.get(wait_for_sync: true) do |members|
1353
1472
  expect(members.count).to eql(members_count)
1354
1473
  expect(members.map(&:member_key).uniq.count).to eql(members_count)
1355
1474
  stop_reactor
@@ -7,9 +7,9 @@ describe Ably::Realtime::Client, '#stats', :event_machine do
7
7
  end
8
8
 
9
9
  describe 'fetching stats' do
10
- it 'should return a PaginatedResource' do
10
+ it 'should return a PaginatedResult' do
11
11
  client.stats do |stats|
12
- expect(stats).to be_a(Ably::Models::PaginatedResource)
12
+ expect(stats).to be_a(Ably::Models::PaginatedResult)
13
13
  stop_reactor
14
14
  end
15
15
  end
@@ -64,7 +64,7 @@ describe Ably::Rest::Channel do
64
64
  end
65
65
  end
66
66
 
67
- it 'should return paged history using the PaginatedResource model' do
67
+ it 'should return paged history using the PaginatedResult model' do
68
68
  page_1 = channel.history(limit: 1)
69
69
  page_2 = page_1.next
70
70
  page_3 = page_2.next
@@ -162,7 +162,7 @@ describe Ably::Models::MessageEncoders do
162
162
  context 'with binary data' do
163
163
  let(:published_data) { binary_data }
164
164
 
165
- it 'applies cipher and base64 encoding and sets the encoding attribute to "utf-8/cipher+aes-128-cbc/base64"' do
165
+ it 'applies cipher and base64 encoding and sets the encoding attribute to "cipher+aes-128-cbc/base64"' do
166
166
  on_publish do |encoding, encoded_data|
167
167
  expect(encoding).to eql('cipher+aes-128-cbc/base64')
168
168
  expect(decrypted(encoded_data, base64: true)).to eql(published_data)
@@ -10,7 +10,7 @@ describe Ably::Rest::Channel, 'messages' do
10
10
  let(:client_options) { default_client_options }
11
11
  let(:client) { Ably::Rest::Client.new(client_options) }
12
12
  let(:other_client) { Ably::Rest::Client.new(client_options) }
13
- let(:channel) { client.channel('test') }
13
+ let(:channel) { client.channel(random_str) }
14
14
 
15
15
  context 'publishing with an ASCII_8BIT message name' do
16
16
  let(:message_name) { random_str.encode(Encoding::ASCII_8BIT) }
@@ -23,6 +23,78 @@ describe Ably::Rest::Channel, 'messages' do
23
23
  end
24
24
  end
25
25
 
26
+ context 'with supported data payload content type' do
27
+ context 'JSON Object (Hash)' do
28
+ let(:data) { { 'Hash' => 'true' } }
29
+
30
+ it 'is encoded and decoded to the same hash' do
31
+ channel.publish 'event', data
32
+ expect(channel.history.items.first.data).to eql(data)
33
+ end
34
+ end
35
+
36
+ context 'JSON Array' do
37
+ let(:data) { [ nil, true, false, 55, 'string', { 'Hash' => true }, ['array'] ] }
38
+
39
+ it 'is encoded and decoded to the same Array' do
40
+ channel.publish 'event', data
41
+ expect(channel.history.items.first.data).to eql(data)
42
+ end
43
+ end
44
+
45
+ context 'String' do
46
+ let(:data) { random_str }
47
+
48
+ it 'is encoded and decoded to the same Array' do
49
+ channel.publish 'event', data
50
+ expect(channel.history.items.first.data).to eql(data)
51
+ end
52
+ end
53
+
54
+ context 'Binary' do
55
+ let(:data) { Base64.encode64(random_str) }
56
+
57
+ it 'is encoded and decoded to the same Array' do
58
+ channel.publish 'event', data
59
+ expect(channel.history.items.first.data).to eql(data)
60
+ end
61
+ end
62
+ end
63
+
64
+ context 'with unsupported data payload content type' do
65
+ context 'Integer' do
66
+ let(:data) { 1 }
67
+
68
+ it 'is raises an UnsupportedDataTypeError 40011 exception' do
69
+ expect { channel.publish 'event', data }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
70
+ end
71
+ end
72
+
73
+ context 'Float' do
74
+ let(:data) { 1.1 }
75
+
76
+ it 'is raises an UnsupportedDataTypeError 40011 exception' do
77
+ expect { channel.publish 'event', data }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
78
+ end
79
+ end
80
+
81
+ context 'Boolean' do
82
+ let(:data) { true }
83
+
84
+ it 'is raises an UnsupportedDataTypeError 40011 exception' do
85
+ expect { channel.publish 'event', data }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
86
+ end
87
+ end
88
+
89
+ context 'False' do
90
+ let(:data) { false }
91
+
92
+ it 'is raises an UnsupportedDataTypeError 40011 exception' do
93
+ expect { channel.publish 'event', data }.to raise_error(Ably::Exceptions::UnsupportedDataTypeError)
94
+ end
95
+ end
96
+ end
97
+
26
98
  describe 'encryption and encoding' do
27
99
  let(:channel_name) { "persisted:#{random_str}" }
28
100
  let(:cipher_options) { { key: random_str(32) } }