anyt 0.5.0 → 0.6.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
2
  SHA1:
3
- metadata.gz: 9a17a52d04971ccd98260602223f3c6e950d4053
4
- data.tar.gz: 372600707b7a49102dbbaa0c9d498561b94bccbc
3
+ metadata.gz: dc8a9b48ea862b7c18a88f919ba3044608a84bd0
4
+ data.tar.gz: 364852883b674847babbff2a412277b110519613
5
5
  SHA512:
6
- metadata.gz: 017ea624b7d10424132d9feb176a1e110e155bd0b3e77c1de26944cae281827aa456d55231ab9112cb82f3fa36b7be49d69833b1e9cbab6c77ab119ff46665ae
7
- data.tar.gz: 0bf7e8c5e0d38c2d30f54ce6113d1f535e64ebfbec8b032c9f20eb9670404664bd0d3554b0ca9d635331845f4798a5a64ca8184ad7a7d0d60dec32466ef614ae
6
+ metadata.gz: '0619e5c190e424a6ae6ded4b22ec8565022e2dc51bf0d210cfdd348efb0cdcbee74d35c9f574639d04f9062ecd21bc8c6e6b16854e25914548e2312992b23c3d'
7
+ data.tar.gz: 289ff66a44d8a3c30aba283c23cd1d9bfaed6268390c3fce48c6932d14885dd9db68a7c1a4b32b8a026b1637595b53771cc3ee7e2de04a46f436d160f4eea593
@@ -21,6 +21,9 @@ AllCops:
21
21
  Rails:
22
22
  Enabled: false
23
23
 
24
+ Lint/MissingCopEnableDirective:
25
+ Enabled: false
26
+
24
27
  Style/AccessorMethodName:
25
28
  Enabled: false
26
29
 
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  # TODO: disconnection tests (verify path and headers available)
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ feature "Broadcast data to stream" do
4
+ channel do
5
+ def subscribed
6
+ stream_from "a"
7
+ end
8
+ end
9
+
10
+ before do
11
+ subscribe_request = { command: "subscribe", identifier: { channel: channel }.to_json }
12
+
13
+ client.send(subscribe_request)
14
+
15
+ ack = {
16
+ "identifier" => { channel: channel }.to_json, "type" => "confirm_subscription"
17
+ }
18
+
19
+ assert_equal ack, client.receive
20
+ end
21
+
22
+ scenario %{
23
+ Broadcast object
24
+ } do
25
+ ActionCable.server.broadcast(
26
+ "a",
27
+ data: { user_id: 1, status: "left", meta: { connection_time: "10s" } }
28
+ )
29
+
30
+ msg = {
31
+ "identifier" => { channel: channel }.to_json,
32
+ "message" => {
33
+ "data" => { "user_id" => 1, "status" => "left", "meta" => { "connection_time" => "10s" } }
34
+ }
35
+ }
36
+
37
+ assert_equal msg, client.receive
38
+ end
39
+
40
+ scenario %{
41
+ Broadcast custom string
42
+ } do
43
+ ActionCable.server.broadcast("a", "<script>alert('Message!');</script>")
44
+
45
+ msg = {
46
+ "identifier" => { channel: channel }.to_json,
47
+ "message" => "<script>alert('Message!');</script>"
48
+ }
49
+
50
+ assert_equal msg, client.receive
51
+ end
52
+
53
+ scenario %{
54
+ Broadcast JSON string
55
+ } do
56
+ ActionCable.server.broadcast("a", '{"script":{"alert":"Message!"}}')
57
+
58
+ msg = {
59
+ "identifier" => { channel: channel }.to_json,
60
+ "message" => '{"script":{"alert":"Message!"}}'
61
+ }
62
+
63
+ assert_equal msg, client.receive
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyt
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.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-10-21 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -268,6 +268,7 @@ files:
268
268
  - lib/anyt/tests/core/welcome_test.rb
269
269
  - lib/anyt/tests/request/connection_test.rb
270
270
  - lib/anyt/tests/request/disconnection_test.rb
271
+ - lib/anyt/tests/streams/broadcast_test.rb
271
272
  - lib/anyt/tests/streams/multiple_clients_test.rb
272
273
  - lib/anyt/tests/streams/multiple_test.rb
273
274
  - lib/anyt/tests/streams/single_test.rb