pubnub 4.1.2 → 4.1.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pubnub might be problematic. Click here for more details.

Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.pubnub.yml +23 -11
  3. data/.rubocop.yml +3 -1
  4. data/.travis.yml +3 -2
  5. data/CHANGELOG.md +7 -0
  6. data/Gemfile.lock +74 -68
  7. data/README.md +1 -1
  8. data/VERSION +1 -2
  9. data/fixtures/vcr_cassettes/lib/events/signal-error.yml +40 -0
  10. data/fixtures/vcr_cassettes/lib/events/signal.yml +40 -0
  11. data/lib/pubnub/client/events.rb +1 -1
  12. data/lib/pubnub/client.rb +1 -0
  13. data/lib/pubnub/constants.rb +2 -1
  14. data/lib/pubnub/events/add_channels_to_push.rb +3 -2
  15. data/lib/pubnub/events/list_push_provisions.rb +2 -2
  16. data/lib/pubnub/events/remove_channels_from_push.rb +3 -2
  17. data/lib/pubnub/events/remove_device_from_push.rb +2 -2
  18. data/lib/pubnub/events/signal.rb +87 -0
  19. data/lib/pubnub/schemas/envelope_schema.rb +54 -27
  20. data/lib/pubnub/subscribe_callback.rb +2 -1
  21. data/lib/pubnub/subscribe_event/formatter.rb +5 -2
  22. data/lib/pubnub/subscriber.rb +2 -0
  23. data/lib/pubnub/validators/push.rb +5 -5
  24. data/lib/pubnub/validators/signal.rb +49 -0
  25. data/lib/pubnub/version.rb +1 -1
  26. data/pubnub.gemspec +6 -5
  27. data/spec/examples/audit_examples_spec.rb +1 -1
  28. data/spec/examples/grant_examples_spec.rb +1 -1
  29. data/spec/examples/presence_examples_spec.rb +12 -12
  30. data/spec/examples/publish_with_ttl_spec.rb +2 -2
  31. data/spec/examples/revoke_examples_spec.rb +1 -1
  32. data/spec/examples/subscribe_examples_spec.rb +1988 -1988
  33. data/spec/lib/custom_retries_examples_spec.rb +1 -1
  34. data/spec/lib/events/audit_spec.rb +7 -7
  35. data/spec/lib/events/channel_registration_spec.rb +3 -3
  36. data/spec/lib/events/delete_messages_spec.rb +2 -2
  37. data/spec/lib/events/grant_spec.rb +6 -6
  38. data/spec/lib/events/heartbeat_spec.rb +2 -2
  39. data/spec/lib/events/here_now_spec.rb +3 -3
  40. data/spec/lib/events/history_spec.rb +3 -3
  41. data/spec/lib/events/leave_spec.rb +2 -2
  42. data/spec/lib/events/presence_spec.rb +5 -5
  43. data/spec/lib/events/publish_spec.rb +2 -2
  44. data/spec/lib/events/revoke_spec.rb +5 -5
  45. data/spec/lib/events/signal_spec.rb +39 -0
  46. data/spec/lib/events/state_spec.rb +3 -3
  47. data/spec/lib/events/subscribe_spec.rb +12 -12
  48. data/spec/lib/events/time_spec.rb +2 -2
  49. data/spec/lib/events/timeout_handling_spec.rb +1 -1
  50. data/spec/lib/events/where_now_spec.rb +3 -3
  51. data/spec/lib/signatures_spec.rb +13 -13
  52. data/spec/lib/ssl_error_spec.rb +1 -1
  53. data/spec/lib/super_admin_spec.rb +1 -1
  54. data/spec/spec_expectations.rb +12 -1
  55. metadata +20 -15
@@ -9,7 +9,7 @@ describe "Custom retries" do
9
9
  @pubnub = Pubnub.new(
10
10
  subscribe_key: "sub-a-mock-key",
11
11
  publish_key: "pub-a-mock-key",
12
- secret_key: "sec-c-MTQyMzhjZGUtNTJiYi00MDU0LThkZWQtZDRmMGUwZDk4NjQz",
12
+ secret_key: "sec-a-mock-key",
13
13
  uuid: "ruby-test-client",
14
14
  )
15
15
  end
@@ -11,7 +11,7 @@ describe Pubnub::Audit do
11
11
  @pubnub = Pubnub::Client.new(
12
12
  subscribe_key: "sub-a-mock-key",
13
13
  publish_key: "pub-a-mock-key",
14
- secret_key: "sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy",
14
+ secret_key: "sec-a-mock-key",
15
15
  auth_key: "ruby-test-auth",
16
16
  uuid: "ruby-test-uuid",
17
17
  )
@@ -23,8 +23,8 @@ describe Pubnub::Audit do
23
23
  channel: :demo,
24
24
  ).value
25
25
 
26
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
27
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
26
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
27
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
28
28
  end
29
29
  end
30
30
 
@@ -35,8 +35,8 @@ describe Pubnub::Audit do
35
35
  ).value
36
36
 
37
37
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
38
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
39
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
38
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
39
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
40
40
  end
41
41
  end
42
42
 
@@ -46,8 +46,8 @@ describe Pubnub::Audit do
46
46
  channel: :demo,
47
47
  ).value
48
48
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
49
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
50
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
49
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
50
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
51
51
  end
52
52
  end
53
53
  end
@@ -21,8 +21,8 @@ describe Pubnub::ChannelRegistration do
21
21
  group: :demo,
22
22
  ).value
23
23
 
24
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
25
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
24
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
25
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
26
26
  end
27
27
  end
28
28
 
@@ -35,7 +35,7 @@ describe Pubnub::ChannelRegistration do
35
35
  ).value
36
36
 
37
37
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
38
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
38
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
39
39
  end
40
40
  end
41
41
  end
@@ -19,7 +19,7 @@ describe Pubnub::DeleteMessages do
19
19
  channel: :demo,
20
20
  ).value
21
21
 
22
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
23
  end
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ describe Pubnub::DeleteMessages do
30
30
  ).value
31
31
 
32
32
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
33
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
33
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
34
34
  end
35
35
  end
36
36
  end
@@ -12,7 +12,7 @@ describe Pubnub::Grant do
12
12
  Pubnub::Client.new(
13
13
  subscribe_key: "sub-a-mock-key",
14
14
  publish_key: "pub-a-mock-key",
15
- secret_key: "sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy",
15
+ secret_key: "sec-a-mock-key",
16
16
  auth_key: "ruby-test-auth",
17
17
  uuid: "ruby-test-uuid",
18
18
  )
@@ -25,16 +25,16 @@ describe Pubnub::Grant do
25
25
 
26
26
  it "works" do
27
27
  VCR.use_cassette("lib/events/grant", record: :once) do
28
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
29
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
28
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
29
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
30
30
  end
31
31
  end
32
32
 
33
33
  it "forms valid ErrorEnvelope on error" do
34
34
  VCR.use_cassette("lib/events/grant-error", record: :once) do
35
35
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
36
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
37
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
36
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
37
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
38
38
  end
39
39
  end
40
40
 
@@ -49,7 +49,7 @@ describe Pubnub::Grant do
49
49
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
50
50
  expect(envelope.status[:code]).to eq 408
51
51
  expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
52
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
52
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
53
53
  end
54
54
  end
55
55
  end
@@ -38,7 +38,7 @@ describe Pubnub::Heartbeat do
38
38
  channel: :demo,
39
39
  ).value
40
40
 
41
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
41
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
42
42
  end
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ describe Pubnub::Heartbeat do
49
49
  ).value
50
50
 
51
51
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
52
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
52
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
53
53
  end
54
54
  end
55
55
  end
@@ -19,8 +19,8 @@ describe Pubnub::HereNow do
19
19
  channel: :demo,
20
20
  ).value
21
21
 
22
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
23
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
24
24
  end
25
25
  end
26
26
 
@@ -31,7 +31,7 @@ describe Pubnub::HereNow do
31
31
  ).value
32
32
 
33
33
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
34
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
34
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
35
35
  end
36
36
  end
37
37
  end
@@ -19,8 +19,8 @@ describe Pubnub::History do
19
19
  channel: :demo,
20
20
  ).value
21
21
 
22
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
23
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
24
24
  end
25
25
  end
26
26
 
@@ -31,7 +31,7 @@ describe Pubnub::History do
31
31
  ).value
32
32
 
33
33
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
34
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
34
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
35
35
  end
36
36
  end
37
37
  end
@@ -19,7 +19,7 @@ describe Pubnub::Leave do
19
19
  channel: :demo,
20
20
  ).value
21
21
 
22
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
23
  end
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ describe Pubnub::Leave do
30
30
  ).value
31
31
 
32
32
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
33
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
33
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
34
34
  end
35
35
  end
36
36
  end
@@ -35,8 +35,8 @@ describe Pubnub::Presence do
35
35
 
36
36
  eventually do
37
37
  envelope = @messages.first
38
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
39
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
38
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
39
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
40
40
  end
41
41
  end
42
42
  end
@@ -78,8 +78,8 @@ describe Pubnub::Presence do
78
78
  envelopes = @pubnub.presence(channel: :demo, http_sync: true)
79
79
 
80
80
  envelope = envelopes.first
81
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
82
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
81
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
82
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
83
83
  end
84
84
  end
85
85
 
@@ -97,7 +97,7 @@ describe Pubnub::Presence do
97
97
 
98
98
  envelope = envelopes.first
99
99
  expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
100
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
100
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
101
101
  end
102
102
  end
103
103
  end
@@ -19,7 +19,7 @@ describe Pubnub::Publish do
19
19
  message: "whatever",
20
20
  ).value
21
21
 
22
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
23
  end
24
24
  end
25
25
 
@@ -31,7 +31,7 @@ describe Pubnub::Publish do
31
31
  ).value
32
32
 
33
33
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
34
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
34
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
35
35
  end
36
36
  end
37
37
  end
@@ -11,7 +11,7 @@ describe Pubnub::Revoke do
11
11
  @pubnub = Pubnub::Client.new(
12
12
  subscribe_key: "sub-a-mock-key",
13
13
  publish_key: "pub-a-mock-key",
14
- secret_key: "sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy",
14
+ secret_key: "sec-a-mock-key",
15
15
  auth_key: "ruby-test-auth",
16
16
  uuid: "ruby-test-uuid",
17
17
  )
@@ -23,8 +23,8 @@ describe Pubnub::Revoke do
23
23
  channel: :demo,
24
24
  ).value
25
25
 
26
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
27
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
26
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
27
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
28
28
  end
29
29
  end
30
30
 
@@ -35,8 +35,8 @@ describe Pubnub::Revoke do
35
35
  ).value
36
36
 
37
37
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
38
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
39
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
38
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
39
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
40
40
  end
41
41
  end
42
42
  end
@@ -0,0 +1,39 @@
1
+ require "spec_helper"
2
+
3
+ describe Pubnub::Signal do
4
+ it_behaves_like "an event"
5
+
6
+ context "given basic parameters" do
7
+ before :each do
8
+ @pubnub = Pubnub::Client.new(
9
+ subscribe_key: "demo",
10
+ publish_key: "demo",
11
+ auth_key: "ruby-test-auth",
12
+ uuid: "ruby-test-uuid",
13
+ )
14
+ end
15
+ it "works" do
16
+ VCR.use_cassette("lib/events/signal", record: :once) do
17
+ envelope = @pubnub.signal(
18
+ channel: :demo,
19
+ message: "whatever",
20
+ ).value
21
+
22
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
23
+ end
24
+ end
25
+
26
+ it "forms valid ErrorEnvelope on error" do
27
+ VCR.use_cassette("lib/events/signal-error", record: :once) do
28
+ envelope = @pubnub.signal(
29
+ channel: :demo,
30
+ message: "0" * 50
31
+ ).value
32
+
33
+ expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
34
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
35
+ end
36
+ end
37
+ end
38
+
39
+ end
@@ -20,8 +20,8 @@ describe Pubnub::State do
20
20
  uuid: :whatever,
21
21
  ).value
22
22
 
23
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
24
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
23
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
24
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
25
25
  end
26
26
  end
27
27
 
@@ -33,7 +33,7 @@ describe Pubnub::State do
33
33
  ).value
34
34
 
35
35
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
36
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
36
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
37
37
  end
38
38
  end
39
39
  end
@@ -36,8 +36,8 @@ describe Pubnub::Subscribe do
36
36
 
37
37
  eventually do
38
38
  envelope = @messages.first
39
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
40
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
39
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
40
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
41
41
  end
42
42
  end
43
43
  end
@@ -94,7 +94,7 @@ describe Pubnub::Subscribe do
94
94
  eventually do
95
95
  envelope = @statuses.first
96
96
  expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
97
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
97
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
98
98
  end
99
99
  end
100
100
  end
@@ -131,8 +131,8 @@ describe Pubnub::Subscribe do
131
131
  envelopes = @pubnub.subscribe(channel: :demo, http_sync: true)
132
132
 
133
133
  envelope = envelopes.first
134
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
135
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
134
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
135
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
136
136
  end
137
137
  end
138
138
 
@@ -150,7 +150,7 @@ describe Pubnub::Subscribe do
150
150
 
151
151
  envelope = envelopes.first
152
152
  expect(envelope).to be_a_kind_of Pubnub::ErrorEnvelope
153
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
153
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
154
154
  end
155
155
  end
156
156
  end
@@ -169,8 +169,8 @@ describe Pubnub::Subscribe do
169
169
  envelopes = @pubnub.subscribe(channels: :demo, http_sync: true)
170
170
 
171
171
  envelope = envelopes.first
172
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
173
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
172
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
173
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
174
174
  end
175
175
  end
176
176
 
@@ -187,8 +187,8 @@ describe Pubnub::Subscribe do
187
187
  envelopes = @pubnub.subscribe(channel_groups: :demo, http_sync: true)
188
188
 
189
189
  envelope = envelopes.first
190
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
191
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
190
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
191
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
192
192
  end
193
193
  end
194
194
  end
@@ -207,8 +207,8 @@ describe Pubnub::Subscribe do
207
207
  envelopes = @pubnub.subscribe(channels: [:demo, :demo1, "demo.*"], with_presence: true, http_sync: true)
208
208
 
209
209
  envelope = envelopes.first
210
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
211
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
210
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
211
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
212
212
  end
213
213
  end
214
214
  end
@@ -16,7 +16,7 @@ describe Pubnub::Time do
16
16
  VCR.use_cassette("lib/events/time", record: :once) do
17
17
  envelope = @pubnub.time.value
18
18
 
19
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
19
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
20
20
  end
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ describe Pubnub::Time do
25
25
  envelope = @pubnub.time.value
26
26
 
27
27
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
28
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
28
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
29
29
  end
30
30
  end
31
31
  end
@@ -23,7 +23,7 @@ describe "timeout" do
23
23
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
24
24
  expect(envelope.status[:code]).to eq 408
25
25
  expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
26
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
26
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
27
27
  end
28
28
  end
29
29
  end
@@ -18,8 +18,8 @@ describe Pubnub::WhereNow do
18
18
  uuid: "ruby-test",
19
19
  ).value
20
20
 
21
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
22
- expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema
21
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
22
+ expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
23
23
  end
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ describe Pubnub::WhereNow do
30
30
  ).value
31
31
 
32
32
  expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
33
- expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
33
+ expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema.new
34
34
  end
35
35
  end
36
36
  end
@@ -12,7 +12,7 @@ describe "Signatures" do
12
12
  pubnub = Pubnub.new(
13
13
  subscribe_key: "sub-a-mock-key",
14
14
  publish_key: "pub-a-mock-key",
15
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
15
+ secret_key: "sec-a-mock-key",
16
16
  uuid: "test",
17
17
  )
18
18
 
@@ -29,7 +29,7 @@ describe "Signatures" do
29
29
  pubnub = Pubnub.new(
30
30
  subscribe_key: "sub-a-mock-key",
31
31
  publish_key: "pub-a-mock-key",
32
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
32
+ secret_key: "sec-a-mock-key",
33
33
  uuid: "test",
34
34
  )
35
35
 
@@ -47,7 +47,7 @@ describe "Signatures" do
47
47
  pubnub = Pubnub.new(
48
48
  subscribe_key: "sub-a-mock-key",
49
49
  publish_key: "pub-a-mock-key",
50
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
50
+ secret_key: "sec-a-mock-key",
51
51
  uuid: "test",
52
52
  )
53
53
 
@@ -65,7 +65,7 @@ describe "Signatures" do
65
65
  pubnub = Pubnub.new(
66
66
  subscribe_key: "sub-a-mock-key",
67
67
  publish_key: "pub-a-mock-key",
68
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
68
+ secret_key: "sec-a-mock-key",
69
69
  uuid: "test",
70
70
  )
71
71
 
@@ -82,7 +82,7 @@ describe "Signatures" do
82
82
  pubnub = Pubnub.new(
83
83
  subscribe_key: "sub-a-mock-key",
84
84
  publish_key: "pub-a-mock-key",
85
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
85
+ secret_key: "sec-a-mock-key",
86
86
  uuid: "test",
87
87
  )
88
88
 
@@ -99,7 +99,7 @@ describe "Signatures" do
99
99
  pubnub = Pubnub.new(
100
100
  subscribe_key: "sub-a-mock-key",
101
101
  publish_key: "pub-a-mock-key",
102
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
102
+ secret_key: "sec-a-mock-key",
103
103
  uuid: "test",
104
104
  )
105
105
 
@@ -116,7 +116,7 @@ describe "Signatures" do
116
116
  pubnub = Pubnub.new(
117
117
  subscribe_key: "sub-a-mock-key",
118
118
  publish_key: "pub-a-mock-key",
119
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
119
+ secret_key: "sec-a-mock-key",
120
120
  uuid: "test",
121
121
  )
122
122
 
@@ -133,7 +133,7 @@ describe "Signatures" do
133
133
  pubnub = Pubnub.new(
134
134
  subscribe_key: "sub-a-mock-key",
135
135
  publish_key: "pub-a-mock-key",
136
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
136
+ secret_key: "sec-a-mock-key",
137
137
  uuid: "test",
138
138
  )
139
139
 
@@ -150,7 +150,7 @@ describe "Signatures" do
150
150
  pubnub = Pubnub.new(
151
151
  subscribe_key: "sub-a-mock-key",
152
152
  publish_key: "pub-a-mock-key",
153
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
153
+ secret_key: "sec-a-mock-key",
154
154
  uuid: "test",
155
155
  )
156
156
 
@@ -165,7 +165,7 @@ describe "Signatures" do
165
165
  pubnub = Pubnub.new(
166
166
  subscribe_key: "sub-a-mock-key",
167
167
  publish_key: "pub-a-mock-key",
168
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
168
+ secret_key: "sec-a-mock-key",
169
169
  uuid: "test",
170
170
  )
171
171
  pubnub.env[:no_telemetry] = true
@@ -215,7 +215,7 @@ describe "Signatures" do
215
215
  pubnub = Pubnub.new(
216
216
  subscribe_key: "sub-a-mock-key",
217
217
  publish_key: "pub-a-mock-key",
218
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
218
+ secret_key: "sec-a-mock-key",
219
219
  uuid: "test",
220
220
  )
221
221
 
@@ -232,7 +232,7 @@ describe "Signatures" do
232
232
  pubnub = Pubnub.new(
233
233
  subscribe_key: "sub-a-mock-key",
234
234
  publish_key: "pub-a-mock-key",
235
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
235
+ secret_key: "sec-a-mock-key",
236
236
  uuid: 'a!@#$%^&()ŻÓŁ[]{}""<>??~`Z',
237
237
  )
238
238
  pubnub.env[:no_telemetry] = true
@@ -258,7 +258,7 @@ describe "Signatures" do
258
258
  pubnub = Pubnub.new(
259
259
  subscribe_key: "sub-a-mock-key",
260
260
  publish_key: "pub-a-mock-key",
261
- secret_key: "sec-c-OTMzNmViNGEtYjg0MS00ZTZkLWI5ZmMtNDYzMDA0NTBlMDdi",
261
+ secret_key: "sec-a-mock-key",
262
262
  uuid: "test",
263
263
  )
264
264
 
@@ -11,7 +11,7 @@ describe "Super admin mode" do
11
11
  @pubnub = Pubnub.new(
12
12
  subscribe_key: "sub-a-mock-key",
13
13
  publish_key: "pub-a-mock-key",
14
- secret_key: "sec-c-MjZkYmQyMDUtYmRhZi00ZDY3LThjZGQtNjU2NmNjNmJkODM3",
14
+ secret_key: "sec-a-mock-key",
15
15
  uuid: "ruby-test",
16
16
  reconnect_interval: 0,
17
17
  ssl: true,
@@ -21,7 +21,7 @@ describe "Super admin mode" do
21
21
  @pubnub = Pubnub.new(
22
22
  subscribe_key: "sub-a-mock-key",
23
23
  publish_key: "pub-a-mock-key",
24
- secret_key: "sec-c-MjZkYmQyMDUtYmRhZi00ZDY3LThjZGQtNjU2NmNjNmJkODM3",
24
+ secret_key: "sec-a-mock-key",
25
25
  uuid: "ruby-test",
26
26
  reconnect_interval: 0,
27
27
  )
@@ -8,6 +8,17 @@ RSpec::Matchers.define :satisfies_schema do |expected|
8
8
 
9
9
  failure_message do |actual|
10
10
  msg = "expected that given hash will fit the schema.\n"
11
- msg + @check.messages.map { |k, v| "#{k}: #{v}" }.join("\n")
11
+
12
+ @check.errors.each do |item|
13
+ item.path.each do |path|
14
+ msg += "#{path}."
15
+ end
16
+
17
+ msg = msg.delete_suffix(".")
18
+
19
+ msg += ": #{item.text}\n"
20
+ end
21
+
22
+ return msg
12
23
  end
13
24
  end