anyt 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anyt/tests/features/channel_state_test.rb +32 -0
- data/lib/anyt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc9f527d5ead1058291854236f7b011c64df27da0be2559bb27893c1dbb471fc
|
4
|
+
data.tar.gz: 0dce342de8720db9d2208e4fc44c7c1ba3b489c0d82bce7b936152df2c70ccca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6237b496a2cfb034d4b0d83eff127be84c360a124039bf14c32e4886732f9b9cff9def7e1515168dc87027ca85bcc64b78dfdd4d10988a1e84206b9fc4be7b3a
|
7
|
+
data.tar.gz: 9cd9d41ebdaf1321d13a08685b1955fe92875fb86fda8c4a230b1df9d30e7e39e5564a2614fb1693666a203926770cbdf3d9a0fda7265f3893524baa7cb8f89a
|
@@ -7,16 +7,25 @@ feature "Channel state" do
|
|
7
7
|
def subscribed
|
8
8
|
self.user = {name: params["name"]}
|
9
9
|
self.count = 1
|
10
|
+
|
11
|
+
stream_from "state_counts"
|
10
12
|
end
|
11
13
|
|
12
14
|
def tick
|
13
15
|
self.count += 2
|
14
16
|
transmit(count: count, name: user[:name])
|
15
17
|
end
|
18
|
+
|
19
|
+
def unsubscribed
|
20
|
+
ActionCable.server.broadcast("state_counts", data: "user left: #{user[:name]}")
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
let(:identifier) { {channel: channel, name: "chipolino"}.to_json }
|
19
25
|
|
26
|
+
let(:client2) { build_client(ignore: %w[ping welcome]) }
|
27
|
+
let(:identifier2) { {channel: channel, name: "chipollone"}.to_json }
|
28
|
+
|
20
29
|
before do
|
21
30
|
subscribe_request = {command: "subscribe", identifier: identifier}
|
22
31
|
|
@@ -44,4 +53,27 @@ feature "Channel state" do
|
|
44
53
|
|
45
54
|
assert_equal msg, client.receive
|
46
55
|
end
|
56
|
+
|
57
|
+
scenario %(
|
58
|
+
Channel state is available in #unsubscribe callbacks
|
59
|
+
) do
|
60
|
+
subscribe_request = {command: "subscribe", identifier: identifier2}
|
61
|
+
|
62
|
+
client2.send(subscribe_request)
|
63
|
+
|
64
|
+
ack = {
|
65
|
+
"identifier" => identifier2, "type" => "confirm_subscription"
|
66
|
+
}
|
67
|
+
|
68
|
+
assert_equal ack, client2.receive
|
69
|
+
|
70
|
+
client.close
|
71
|
+
|
72
|
+
msg = {
|
73
|
+
"identifier" => identifier2,
|
74
|
+
"message" => {"data" => "user left: chipolino"}
|
75
|
+
}
|
76
|
+
|
77
|
+
assert_equal msg, client2.receive
|
78
|
+
end
|
47
79
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|