rails-jsdom 0.1.0 → 0.2.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.
@@ -24,6 +24,15 @@ module RailsJsdom
24
24
  class TestCase < ActionDispatch::IntegrationTest
25
25
  include TestHelper
26
26
 
27
- teardown { RailsJsdom.bridge.reset }
27
+ setup do
28
+ rails_jsdom_clock
29
+ rails_jsdom_take_over_pubsub
30
+ end
31
+
32
+ teardown do
33
+ RailsJsdom.bridge.reset
34
+ rails_jsdom_close_cables
35
+ rails_jsdom_restore_pubsub
36
+ end
28
37
  end
29
38
  end
@@ -86,12 +86,12 @@ module RailsJsdom
86
86
  # Goes back one history entry: a Turbo Drive visit or a full page load.
87
87
  # Does nothing on the first page.
88
88
  def go_back
89
- rails_jsdom_perform(command: "traverse", delta: -1)
89
+ rails_jsdom_call(command: "traverse", delta: -1)
90
90
  end
91
91
 
92
92
  # Goes forward one history entry after #go_back.
93
93
  def go_forward
94
- rails_jsdom_perform(command: "traverse", delta: 1)
94
+ rails_jsdom_call(command: "traverse", delta: 1)
95
95
  end
96
96
 
97
97
  # Runs the block as another user, with its own cookies and its own page.
@@ -121,7 +121,7 @@ module RailsJsdom
121
121
  #
122
122
  # mount_html %(<div data-controller="counter"></div>)
123
123
  def mount_html(html)
124
- rails_jsdom_perform(command: "load", html: RailsJsdom.document(html), url: "http://#{host}/", history: "push")
124
+ rails_jsdom_call(command: "load", html: RailsJsdom.document(html), url: "http://#{host}/", history: "push")
125
125
  end
126
126
 
127
127
  # Answers the page's requests to `url` with the given response instead of
@@ -133,6 +133,18 @@ module RailsJsdom
133
133
  RailsJsdom.bridge.call(command: "stub_fetch", url: url, response: { status: status, headers: headers, body: body })
134
134
  end
135
135
 
136
+ # Gives elements matching `selector`, anything inside them, and text ranges
137
+ # that start inside them the box `width` by `height` at `left`, `top`,
138
+ # instead of the 0x0 box at 0,0 that jsdom gives everything, until the next
139
+ # page load. For a test whose page waits for a real measurement, such as an
140
+ # editor that positions a menu at the caret, when where things are does not
141
+ # matter to the test. Call it after the page is loaded.
142
+ #
143
+ # stub_layout "#composer .lexxy-editor__content"
144
+ def stub_layout(selector, width: 100, height: 20, top: 10, left: 10)
145
+ RailsJsdom.bridge.call(command: "stub_layout", selector: selector, box: { width: width, height: height, top: top, left: left })
146
+ end
147
+
136
148
  # The page: an object with every helper in this module, plus
137
149
  # RailsJsdom::Page#body and RailsJsdom::Page#title.
138
150
  def page
@@ -150,7 +162,7 @@ module RailsJsdom
150
162
  # Clicks the link or button found by `locator`.
151
163
  #
152
164
  # click_on "Add to cart"
153
- def click_on(locator, match: nil)
165
+ def click_on(locator = nil, match: nil)
154
166
  rails_jsdom_act("click", locator, match, kind: "link_or_button")
155
167
  end
156
168
  alias_method :click_link_or_button, :click_on
@@ -158,14 +170,14 @@ module RailsJsdom
158
170
  # Clicks the link found by `locator`.
159
171
  #
160
172
  # click_link "Second page"
161
- def click_link(locator, match: nil)
173
+ def click_link(locator = nil, match: nil)
162
174
  rails_jsdom_act("click", locator, match, kind: "link")
163
175
  end
164
176
 
165
177
  # Clicks the button found by `locator`.
166
178
  #
167
179
  # click_button "Save"
168
- def click_button(locator, match: nil)
180
+ def click_button(locator = nil, match: nil)
169
181
  rails_jsdom_act("click", locator, match, kind: "button")
170
182
  end
171
183
 
@@ -222,14 +234,14 @@ module RailsJsdom
222
234
  #
223
235
  # select "Canada", from: "Country"
224
236
  def select(value, from: nil, match: nil)
225
- rails_jsdom_perform(command: "select", option: value.to_s, from: from, selected: true, scope: rails_jsdom_scope, match: match)
237
+ rails_jsdom_call(command: "select", option: value.to_s, from: from, selected: true, scope: rails_jsdom_scope, match: match)
226
238
  end
227
239
 
228
240
  # Deselects the option `value` in a select that allows multiple options.
229
241
  #
230
242
  # unselect "Red", from: "Colours"
231
243
  def unselect(value, from: nil, match: nil)
232
- rails_jsdom_perform(command: "select", option: value.to_s, from: from, selected: false, scope: rails_jsdom_scope, match: match)
244
+ rails_jsdom_call(command: "select", option: value.to_s, from: from, selected: false, scope: rails_jsdom_scope, match: match)
233
245
  end
234
246
 
235
247
  # Puts the files at `paths` (one path or an array) in the file field found
@@ -239,9 +251,22 @@ module RailsJsdom
239
251
  # `ActionDispatch::Http::UploadedFile` params.
240
252
  #
241
253
  # attach_file "Avatar", file_fixture("avatar.png")
242
- def attach_file(locator, paths, match: nil)
243
- files = Array(paths).map { |path| { name: File.basename(path), type: Rack::Mime.mime_type(File.extname(path.to_s)), base64: [ File.binread(path) ].pack("m0") } }
244
- rails_jsdom_act("attach", locator, match, files: files)
254
+ #
255
+ # With a block, `attach_file` takes only the paths, and puts them in the
256
+ # file field that the block opens a file chooser for, as when a script
257
+ # calls `click()` on a file field it created. The field need not be on
258
+ # the page. Raises RailsJsdom::Error if the block opened no file chooser.
259
+ #
260
+ # attach_file(file_fixture("avatar.png")) { click_on "Upload" }
261
+ def attach_file(locator, paths = nil, match: nil, **options)
262
+ RailsJsdom.reject_options(options.keys)
263
+ if block_given?
264
+ RailsJsdom.bridge.call(command: "expect_file_chooser", files: rails_jsdom_files(locator))
265
+ yield
266
+ RailsJsdom.bridge.call(command: "file_chooser_opened") || raise(Error, "No file chooser opened in the attach_file block")
267
+ else
268
+ rails_jsdom_act("attach", locator, match, files: rails_jsdom_files(paths))
269
+ end
245
270
  end
246
271
 
247
272
  # Types `keys` into the focused element. A String types its characters; a
@@ -262,7 +287,7 @@ module RailsJsdom
262
287
  # find_field("Search").send_keys("mugs", :enter)
263
288
  # send_keys [ :shift, :tab ]
264
289
  def send_keys(*keys)
265
- rails_jsdom_perform(command: "send_keys", keys: RailsJsdom.keys(keys))
290
+ rails_jsdom_call(command: "send_keys", keys: RailsJsdom.keys(keys))
266
291
  end
267
292
 
268
293
  # Scopes every action, finder and assertion in the block to the one
@@ -292,8 +317,8 @@ module RailsJsdom
292
317
  # `match: :first`.
293
318
  #
294
319
  # find(".cart-item", text: "Mug").click
295
- def find(selector, match: nil, **filters)
296
- rails_jsdom_find(Query.new("css", selector, **filters), match)
320
+ def find(selector = nil, match: nil, **filters)
321
+ rails_jsdom_find(Query.new("css", selector || "*", **filters), match)
297
322
  end
298
323
 
299
324
  # The one field found by `locator` (see Locators) that matches the
@@ -318,27 +343,29 @@ module RailsJsdom
318
343
  # none.
319
344
  #
320
345
  # all(".cart-item").map(&:text)
321
- def all(selector, **filters)
322
- rails_jsdom_elements(Query.new("css", selector, **filters))
346
+ def all(selector = nil, **filters)
347
+ rails_jsdom_elements(Query.new("css", selector || "*", **filters))
323
348
  end
324
349
 
325
350
  # The first element that matches the CSS `selector` and the filters.
326
351
  # Raises RailsJsdom::Error when none matches.
327
- def first(selector, **filters)
328
- rails_jsdom_find(Query.new("css", selector, **filters), :first)
352
+ def first(selector = nil, **filters)
353
+ rails_jsdom_find(Query.new("css", selector || "*", **filters), :first)
329
354
  end
330
355
 
331
356
  # Runs `script` in the page, settles it and returns the script's value,
332
357
  # awaited if it is a promise. The value must be JSON-serialisable.
333
358
  #
334
359
  # evaluate_script("document.title") # => "Projects"
335
- def evaluate_script(script)
336
- rails_jsdom_perform(command: "evaluate", script: script)
360
+ def evaluate_script(script, *arguments)
361
+ rails_jsdom_script(script, arguments, "expression")
337
362
  end
338
363
 
339
- # Runs `script` in the page and settles it, returning nothing.
340
- def execute_script(script)
341
- evaluate_script(script)
364
+ # Runs `script` in the page and settles it, returning nothing. As in
365
+ # system tests, extra arguments are available to the script as
366
+ # `arguments`; an element from `find` arrives as that DOM element.
367
+ def execute_script(script, *arguments)
368
+ rails_jsdom_script(script, arguments, "statements")
342
369
  nil
343
370
  end
344
371
 
@@ -604,25 +631,67 @@ module RailsJsdom
604
631
  rails_jsdom_scope.empty? ? Nokogiri::HTML5(html).root : Nokogiri::HTML5.fragment(html, context: "template").element_children.first
605
632
  end
606
633
 
634
+ def rails_jsdom_script(script, arguments, kind, receiver = nil) # :nodoc:
635
+ if arguments.empty? && receiver.nil?
636
+ rails_jsdom_call(command: "evaluate", script: script)
637
+ else
638
+ rails_jsdom_call(command: "evaluate", script: script, kind: kind, receiver: receiver, args: arguments.map { |argument| rails_jsdom_script_value(argument) })
639
+ end
640
+ end
641
+
642
+ def rails_jsdom_script_value(argument) # :nodoc:
643
+ argument.is_a?(Element) ? { rails_jsdom_element: argument.handle } : argument
644
+ end
645
+
607
646
  def rails_jsdom_element(handle, action, **options) # :nodoc:
608
- rails_jsdom_perform(command: "element", handle: handle, action: action, **options)
647
+ rails_jsdom_call(command: "element", handle: handle, action: action, **options)
609
648
  end
610
649
 
611
650
  def rails_jsdom_read(handle) # :nodoc:
612
- rails_jsdom_deliver_broadcasts
651
+ rails_jsdom_catch_up
613
652
  RailsJsdom.bridge.call(command: "read", handle: handle)
614
653
  end
615
654
 
616
655
  def rails_jsdom_page_snapshot # :nodoc:
617
- rails_jsdom_deliver_broadcasts
656
+ rails_jsdom_catch_up
618
657
  RailsJsdom.bridge.call(command: "snapshot", scope: [])
619
658
  end
620
659
 
660
+ def rails_jsdom_answer(request) # :nodoc:
661
+ request["kind"] == "cable" ? rails_jsdom_cable_answer(request) : rails_jsdom_http_answer(request)
662
+ end
663
+
664
+ def rails_jsdom_sync # :nodoc:
665
+ rails_jsdom_clock.view.merge(frames: rails_jsdom_cable.drain)
666
+ end
667
+
668
+ def rails_jsdom_page_clock(now) # :nodoc:
669
+ rails_jsdom_clock.page_time(now)
670
+ end
671
+
672
+ def rails_jsdom_clock # :nodoc:
673
+ @rails_jsdom_clock ||= Clock.new(Time.now) { |time| travel_to(time, with_usec: true) }
674
+ end
675
+
676
+ def rails_jsdom_take_over_pubsub # :nodoc:
677
+ @rails_jsdom_previous_pubsub = ActionCable.server.pubsub
678
+ @rails_jsdom_pubsub = CableAdapter.new(ActionCable.server)
679
+ ActionCable.server.instance_variable_set(:@pubsub, @rails_jsdom_pubsub)
680
+ end
681
+
682
+ def rails_jsdom_restore_pubsub # :nodoc:
683
+ ActionCable.server.instance_variable_set(:@pubsub, @rails_jsdom_previous_pubsub)
684
+ end
685
+
686
+ def rails_jsdom_close_cables # :nodoc:
687
+ (@rails_jsdom_cables || {}).each_value(&:close)
688
+ end
689
+
621
690
  private
622
691
 
623
692
  def rails_jsdom_visit(path, history)
624
693
  rails_jsdom_request("GET", path, headers: {})
625
- rails_jsdom_perform(command: "load", html: response.body, url: request.url, history: history)
694
+ rails_jsdom_call(command: "load", html: response.body, url: request.original_url, history: history)
626
695
  end
627
696
 
628
697
  def rails_jsdom_session_name
@@ -650,7 +719,11 @@ module RailsJsdom
650
719
  end
651
720
 
652
721
  def rails_jsdom_act(command, locator, match, **options)
653
- rails_jsdom_perform(command: command, locator: locator, scope: rails_jsdom_scope, match: match, **options)
722
+ rails_jsdom_call(command: command, locator: locator, scope: rails_jsdom_scope, match: match, **options)
723
+ end
724
+
725
+ def rails_jsdom_files(paths)
726
+ Array(paths).map { |path| { name: File.basename(path), type: Rack::Mime.mime_type(File.extname(path.to_s)), base64: [ File.binread(path) ].pack("m0") } }
654
727
  end
655
728
 
656
729
  def rails_jsdom_modal(type, accept, text, with: nil)
@@ -661,7 +734,7 @@ module RailsJsdom
661
734
  end
662
735
 
663
736
  def rails_jsdom_matches(query)
664
- rails_jsdom_deliver_broadcasts
737
+ rails_jsdom_catch_up
665
738
  query.filter(RailsJsdom.bridge.call(**query.message, scope: rails_jsdom_scope))
666
739
  end
667
740
 
@@ -706,37 +779,41 @@ module RailsJsdom
706
779
  end
707
780
 
708
781
  def rails_jsdom_snapshot
709
- rails_jsdom_deliver_broadcasts
782
+ rails_jsdom_catch_up
710
783
  RailsJsdom.bridge.call(command: "snapshot", scope: rails_jsdom_scope)
711
784
  end
712
785
 
713
- def rails_jsdom_deliver_broadcasts
714
- messages = rails_jsdom_undelivered_broadcasts
715
- if messages.any?
716
- rails_jsdom_call(command: "deliver", messages: messages)
717
- rails_jsdom_deliver_broadcasts
718
- end
786
+ def rails_jsdom_cable_answer(request)
787
+ uri = URI(request.fetch("url", "ws://#{host}"))
788
+ uri.host == host ? rails_jsdom_cable.answer(request, rails_jsdom_cookie(uri)) : { error: "RailsJsdom opens cable connections only to #{host}, not to #{uri}." }
789
+ end
790
+
791
+ def rails_jsdom_cookie(uri)
792
+ integration_session.cookies.for(URI("http://#{host}#{uri.path}"))
719
793
  end
720
794
 
721
- def rails_jsdom_undelivered_broadcasts
722
- streams = RailsJsdom.bridge.call(command: "streams").filter_map { |name| Turbo::StreamsChannel.verified_stream_name(name) }.uniq
723
- rails_jsdom_deliveries.undelivered_messages(rails_jsdom_session_name, streams)
795
+ def rails_jsdom_catch_up
796
+ if rails_jsdom_cable.active?
797
+ rails_jsdom_call(command: "settle")
798
+ elsif rails_jsdom_clock.moved? || rails_jsdom_cable_failed?
799
+ rails_jsdom_call(command: "catch_up")
800
+ end
724
801
  end
725
802
 
726
- def rails_jsdom_deliveries
727
- @rails_jsdom_deliveries ||= TurboStreamDeliveries.new
803
+ def rails_jsdom_cable_failed?
804
+ !!@rails_jsdom_pubsub&.failed?
728
805
  end
729
806
 
730
- def rails_jsdom_perform(**message)
731
- rails_jsdom_deliver_broadcasts
732
- rails_jsdom_call(message).tap { rails_jsdom_deliver_broadcasts }
807
+ def rails_jsdom_cable
808
+ (@rails_jsdom_cables ||= {})[rails_jsdom_session_name] ||= Cable.new(rails_jsdom_clock)
733
809
  end
734
810
 
735
811
  def rails_jsdom_call(message)
736
- RailsJsdom.bridge.call(message) { |fetch| rails_jsdom_fetch(fetch) }
812
+ @rails_jsdom_pubsub&.raise_failure
813
+ RailsJsdom.bridge.call(message, self)
737
814
  end
738
815
 
739
- def rails_jsdom_fetch(fetch)
816
+ def rails_jsdom_http_answer(fetch)
740
817
  uri = URI(fetch.fetch("url"))
741
818
  if uri.host == host
742
819
  redirected = rails_jsdom_request(fetch.fetch("method"), uri.request_uri, params: fetch["body"]&.unpack1("m"), headers: fetch.fetch("headers"))
@@ -747,7 +824,7 @@ module RailsJsdom
747
824
  end
748
825
 
749
826
  def rails_jsdom_fetch_reply(redirected)
750
- { status: response.status, headers: response.headers.to_h.except("set-cookie"), body: response.body, url: request.url, redirected: redirected }
827
+ { status: response.status, headers: response.headers.to_h.except("set-cookie"), body: response.body, url: request.original_url, redirected: redirected }
751
828
  end
752
829
 
753
830
  def rails_jsdom_request(method, path, headers:, params: nil)
@@ -1,4 +1,4 @@
1
1
  module RailsJsdom
2
2
  # The version of the rails-jsdom gem.
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
data/lib/rails_jsdom.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "json"
2
2
  require "open3"
3
+ require "timeout"
4
+ require "action_cable"
3
5
  require_relative "rails_jsdom/version"
4
6
 
5
7
  # Browserless interaction tests for Rails apps built with Stimulus, Turbo and
@@ -19,8 +21,22 @@ module RailsJsdom
19
21
  REMOTE = %r{\A[a-z][a-z0-9+.-]*://}i
20
22
  HIDDEN_SELECTOR = "[hidden], template, script, style, noscript, dialog:not([open]), [style*='display: none'], [style*='display:none']".freeze
21
23
  TIMER_HORIZON = 1000
24
+ COMMAND_TIMEOUT = 30
25
+ OPTION_ADVICE = {
26
+ wait: "rails-jsdom settles the page before every finder and assertion",
27
+ make_visible: "rails-jsdom attaches files to hidden fields too"
28
+ }.freeze
22
29
 
23
30
  class << self
31
+ attr_writer :command_timeout
32
+
33
+ # Seconds to wait for the page to answer a command. A page in an endless
34
+ # loop never answers; after this long its Node process is stopped and the
35
+ # command fails, instead of the test run hanging.
36
+ def command_timeout
37
+ @command_timeout || COMMAND_TIMEOUT
38
+ end
39
+
24
40
  def bridge
25
41
  bridges[Process.pid] ||= Bridge.new(command: [ "node", RUNNER ], setup: setup, logger: Rails.logger)
26
42
  end
@@ -50,6 +66,16 @@ module RailsJsdom
50
66
  Rails.application.importmap.directories.values.to_h { |directory| [ directory.under, Rails.root.join(directory.dir).to_s ] }
51
67
  end
52
68
 
69
+ def reject_options(keywords) # :nodoc:
70
+ advised = keywords.find { |keyword| OPTION_ADVICE.key?(keyword) }
71
+ raise ArgumentError, "#{advised}: does nothing here, because #{OPTION_ADVICE.fetch(advised)}. Remove it." if advised
72
+ raise ArgumentError, unknown_keywords(keywords) if keywords.any?
73
+ end
74
+
75
+ def unknown_keywords(keywords) # :nodoc:
76
+ "unknown keyword#{"s" if keywords.many?}: #{keywords.map(&:inspect).join(", ")}"
77
+ end
78
+
53
79
  def keys(keys)
54
80
  keys.map { |key| key.is_a?(Array) ? key_entry(key.last).merge(modifiers: key[0...-1].map(&:to_s)) : key_entry(key) }
55
81
  end
@@ -76,8 +102,15 @@ end
76
102
 
77
103
  require_relative "rails_jsdom/bridge"
78
104
  require_relative "rails_jsdom/query"
79
- require_relative "rails_jsdom/turbo_stream_deliveries"
105
+ require_relative "rails_jsdom/clock"
106
+ require_relative "rails_jsdom/cable_adapter"
107
+ require_relative "rails_jsdom/cable_server"
108
+ require_relative "rails_jsdom/cable_failure"
109
+ require_relative "rails_jsdom/cable_socket"
110
+ require_relative "rails_jsdom/cable"
80
111
  require_relative "rails_jsdom/element"
81
112
  require_relative "rails_jsdom/test_helper"
82
113
  require_relative "rails_jsdom/page"
83
114
  require_relative "rails_jsdom/test_case"
115
+
116
+ ActionCable::Server::Base.prepend(RailsJsdom::CableServer::Takeover)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-jsdom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Howerton
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.1'
18
+ version: '8.1'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '7.1'
25
+ version: '8.1'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: actionpack
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '7.1'
32
+ version: '8.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '7.1'
39
+ version: '8.1'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: importmap-rails
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,12 @@ files:
111
111
  - lib/generators/rails_jsdom/install/install_generator.rb
112
112
  - lib/rails_jsdom.rb
113
113
  - lib/rails_jsdom/bridge.rb
114
+ - lib/rails_jsdom/cable.rb
115
+ - lib/rails_jsdom/cable_adapter.rb
116
+ - lib/rails_jsdom/cable_failure.rb
117
+ - lib/rails_jsdom/cable_server.rb
118
+ - lib/rails_jsdom/cable_socket.rb
119
+ - lib/rails_jsdom/clock.rb
114
120
  - lib/rails_jsdom/element.rb
115
121
  - lib/rails_jsdom/page.rb
116
122
  - lib/rails_jsdom/query.rb
@@ -118,7 +124,6 @@ files:
118
124
  - lib/rails_jsdom/runtime.js
119
125
  - lib/rails_jsdom/test_case.rb
120
126
  - lib/rails_jsdom/test_helper.rb
121
- - lib/rails_jsdom/turbo_stream_deliveries.rb
122
127
  - lib/rails_jsdom/version.rb
123
128
  homepage: https://github.com/jakehow/rails-jsdom
124
129
  licenses:
@@ -1,25 +0,0 @@
1
- module RailsJsdom
2
- class TurboStreamDeliveries # :nodoc:
3
- def initialize
4
- @delivered = {}
5
- end
6
-
7
- def undelivered_messages(session, streams)
8
- previously_delivered = @delivered.fetch(session, {})
9
- @delivered[session] = streams.to_h { |stream| [ stream, broadcasts(stream).size ] }
10
- streams.flat_map { |stream| new_messages(stream, previously_delivered) }
11
- end
12
-
13
- private
14
-
15
- def new_messages(stream, previously_delivered)
16
- sent = broadcasts(stream)
17
- unseen = sent.drop(previously_delivered.fetch(stream, sent.size))
18
- unseen.map { |payload| ActiveSupport::JSON.decode(payload) }.grep(String)
19
- end
20
-
21
- def broadcasts(stream)
22
- ActionCable.server.pubsub.broadcasts(stream)
23
- end
24
- end
25
- end