You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/subscriptions/action_cable_implementation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ index: 4
10
10
11
11
[ActionCable](https://guides.rubyonrails.org/action_cable_overview.html) is a great platform for delivering GraphQL subscriptions on Rails 5+. It handles message passing (via `broadcast`) and transport (via `transmit` over a websocket).
12
12
13
-
To get started, see examples in the API docs: {{ "GraphQL::Subscriptions::ActionCableSubscriptions" | api_doc }}.
13
+
To get started, see examples in the API docs: {{ "GraphQL::Subscriptions::ActionCableSubscriptions" | api_doc }}. GraphQL-Ruby also includes a mock ActionCable implementation for testing: {{ "GraphQL::Testing::MockActionCable" | api_doc }}.
# ActionCableTestSchema.subscriptions.trigger(:news_flash, {}, {text: "After yesterday's rain, someone stopped on Rio Road to help a box turtle across five lanes of traffic"})
26
+
#
27
+
# # Check messages on the channel
28
+
# expected_msg = {
29
+
# result: {
30
+
# "data" => {
31
+
# "newsFlash" => {
32
+
# "text" => "After yesterday's rain, someone stopped on Rio Road to help a box turtle across five lanes of traffic"
ActionCableTestSchema.execute("subscription { newsFlash { text } }",context: {channel: mock_channel})
133
71
ActionCableTestSchema.subscriptions.trigger(:news_flash,{},{text: "After yesterday's rain, someone stopped on Rio Road to help a box turtle across five lanes of traffic"})
ActionCableTestSchema.subscriptions.trigger(:news_flash,{filter: {trending: true}},{text: "Neighbor shares bumper crop of summer squash with widow next door"})
ActionCableTestSchema.subscriptions.trigger(:news_flash,{keywords: [{value: "rain",fuzzy: true}]},{text: "After yesterday's rain, someone stopped on Rio Road to help a box turtle across five lanes of traffic"})
0 commit comments