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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dc8a9b48ea862b7c18a88f919ba3044608a84bd0
4
- data.tar.gz: 364852883b674847babbff2a412277b110519613
2
+ SHA256:
3
+ metadata.gz: eb7411c1afe37ebd51981648bbe24ceb80967e03189e99ac51c42d4be9f4ef5a
4
+ data.tar.gz: '0009b2a240eb1a81c5506887eddbdf4e8ce502d5c74fdd34cf8bc3dcaa21b7be'
5
5
  SHA512:
6
- metadata.gz: '0619e5c190e424a6ae6ded4b22ec8565022e2dc51bf0d210cfdd348efb0cdcbee74d35c9f574639d04f9062ecd21bc8c6e6b16854e25914548e2312992b23c3d'
7
- data.tar.gz: 289ff66a44d8a3c30aba283c23cd1d9bfaed6268390c3fce48c6932d14885dd9db68a7c1a4b32b8a026b1637595b53771cc3ee7e2de04a46f436d160f4eea593
6
+ metadata.gz: 48911f822229c658a154a20c8fd08fb7b6245b09a95776681aaad8b4f3101d773b6d99252129b027b5828ffcdd52fdf62ace6172f65f3639e8958d174098b4d3
7
+ data.tar.gz: 6915a55afec899cd6cc8fa64b5641c97e9c30e1ff8408c56a344325bd5a0d54e3d13536d8cc8d66aecc12b1ef6736663cea590b0148222b9fcca4ecdf2dc8287
@@ -24,6 +24,12 @@ Rails:
24
24
  Lint/MissingCopEnableDirective:
25
25
  Enabled: false
26
26
 
27
+ Naming/UncommunicativeMethodParamName:
28
+ Enabled: false
29
+
30
+ Naming/VariableNumber:
31
+ Enabled: false
32
+
27
33
  Style/AccessorMethodName:
28
34
  Enabled: false
29
35
 
@@ -53,6 +53,9 @@ module Anyt
53
53
  message = JSON.parse(event.data)
54
54
 
55
55
  next if ignore_message_types.include?(message["type"])
56
+
57
+ Anycable.logger.debug "Message received: #{message}"
58
+
56
59
  messages << message
57
60
  has_messages.release
58
61
  end
@@ -1,2 +1,64 @@
1
1
  # frozen_string_literal: true
2
- # TODO: disconnection tests (verify path and headers available)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyt
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
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.6.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: 2017-12-22 00:00:00.000000000 Z
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.6.13
302
+ rubygems_version: 2.7.7
302
303
  signing_key:
303
304
  specification_version: 4
304
305
  summary: Anycable conformance testing tool