anyt 0.6.0 → 0.7.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 +5 -5
- data/.rubocop.yml +6 -0
- data/lib/anyt/client.rb +3 -0
- data/lib/anyt/tests/request/disconnection_test.rb +63 -1
- data/lib/anyt/tests/subscriptions/params_test.rb +30 -0
- data/lib/anyt/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eb7411c1afe37ebd51981648bbe24ceb80967e03189e99ac51c42d4be9f4ef5a
|
4
|
+
data.tar.gz: '0009b2a240eb1a81c5506887eddbdf4e8ce502d5c74fdd34cf8bc3dcaa21b7be'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48911f822229c658a154a20c8fd08fb7b6245b09a95776681aaad8b4f3101d773b6d99252129b027b5828ffcdd52fdf62ace6172f65f3639e8958d174098b4d3
|
7
|
+
data.tar.gz: 6915a55afec899cd6cc8fa64b5641c97e9c30e1ff8408c56a344325bd5a0d54e3d13536d8cc8d66aecc12b1ef6736663cea590b0148222b9fcca4ecdf2dc8287
|
data/.rubocop.yml
CHANGED
data/lib/anyt/client.rb
CHANGED
@@ -1,2 +1,64 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
feature "Request" do
|
4
|
+
channel(:a) do
|
5
|
+
def subscribed
|
6
|
+
stream_from "a"
|
7
|
+
end
|
8
|
+
|
9
|
+
def unsubscribed
|
10
|
+
ActionCable.server.broadcast("a", data: "user left")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
channel(:b) do
|
15
|
+
def subscribed
|
16
|
+
stream_from "b"
|
17
|
+
end
|
18
|
+
|
19
|
+
def unsubscribed
|
20
|
+
ActionCable.server.broadcast("b", data: "user left")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:client2) { build_client(ignore: %w[ping welcome]) }
|
25
|
+
|
26
|
+
before do
|
27
|
+
[client, client2].each do |client_|
|
28
|
+
subscribe_request = { command: "subscribe", identifier: { channel: a_channel }.to_json }
|
29
|
+
|
30
|
+
client_.send(subscribe_request)
|
31
|
+
|
32
|
+
ack = {
|
33
|
+
"identifier" => { channel: a_channel }.to_json, "type" => "confirm_subscription"
|
34
|
+
}
|
35
|
+
|
36
|
+
assert_equal ack, client_.receive
|
37
|
+
|
38
|
+
subscribe_request = { command: "subscribe", identifier: { channel: b_channel }.to_json }
|
39
|
+
|
40
|
+
client_.send(subscribe_request)
|
41
|
+
|
42
|
+
ack = {
|
43
|
+
"identifier" => { channel: b_channel }.to_json, "type" => "confirm_subscription"
|
44
|
+
}
|
45
|
+
|
46
|
+
assert_equal ack, client_.receive
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
scenario %{
|
51
|
+
Client disconnect invokes #unsubscribe callbacks
|
52
|
+
} do
|
53
|
+
|
54
|
+
client2.close
|
55
|
+
|
56
|
+
msg = { "identifier" => { channel: a_channel }.to_json, "message" => { "data" => "user left" } }
|
57
|
+
msg2 = { "identifier" => { channel: b_channel }.to_json, "message" => { "data" => "user left" } }
|
58
|
+
|
59
|
+
msgs = [client.receive, client.receive]
|
60
|
+
|
61
|
+
assert_includes msgs, msg
|
62
|
+
assert_includes msgs, msg2
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
feature "Subscription with params" do
|
4
|
+
channel
|
5
|
+
|
6
|
+
scenario %{
|
7
|
+
Client subscribes to the same channel with different params
|
8
|
+
} do
|
9
|
+
|
10
|
+
subscribe_request = { command: "subscribe", identifier: { channel: channel, id: 1 }.to_json }
|
11
|
+
|
12
|
+
client.send(subscribe_request)
|
13
|
+
|
14
|
+
ack = {
|
15
|
+
"identifier" => { channel: channel, id: 1 }.to_json, "type" => "confirm_subscription"
|
16
|
+
}
|
17
|
+
|
18
|
+
assert_equal ack, client.receive
|
19
|
+
|
20
|
+
subscribe_request_2 = { command: "subscribe", identifier: { channel: channel, id: 2 }.to_json }
|
21
|
+
|
22
|
+
client.send(subscribe_request_2)
|
23
|
+
|
24
|
+
ack = {
|
25
|
+
"identifier" => { channel: channel, id: 2 }.to_json, "type" => "confirm_subscription"
|
26
|
+
}
|
27
|
+
|
28
|
+
assert_equal ack, client.receive
|
29
|
+
end
|
30
|
+
end
|
data/lib/anyt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anyt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- lib/anyt/tests/streams/multiple_test.rb
|
274
274
|
- lib/anyt/tests/streams/single_test.rb
|
275
275
|
- lib/anyt/tests/subscriptions/ack_test.rb
|
276
|
+
- lib/anyt/tests/subscriptions/params_test.rb
|
276
277
|
- lib/anyt/tests/subscriptions/perform_test.rb
|
277
278
|
- lib/anyt/tests/subscriptions/transmissions_test.rb
|
278
279
|
- lib/anyt/utils.rb
|
@@ -298,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
299
|
version: '0'
|
299
300
|
requirements: []
|
300
301
|
rubyforge_project:
|
301
|
-
rubygems_version: 2.
|
302
|
+
rubygems_version: 2.7.7
|
302
303
|
signing_key:
|
303
304
|
specification_version: 4
|
304
305
|
summary: Anycable conformance testing tool
|