action-cable-testing 0.3.1 → 0.3.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c23fc604360442ed682c5d15aabb5ddf73975a930c9eb04e7e8d322f4585d5bd
|
4
|
+
data.tar.gz: 8fe5232fe5a87fa52e0947d5e89d91f29b8b7128e39222c4596efd4e6323ff34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20572b174c043b0c4400392043d3abd2702901796a9f490d337e2bf13afe533a3ca8f316c8efbd300bbb1d8edc68c926f8e34e7a68e36aa40fc542ae71c5713e
|
7
|
+
data.tar.gz: 81273128fee887ed0985d52ba5ddeaac5358a394d86c05f995a042f5a29548ac83ecbac02eaff6153f393a9cc320c4e895a07bd8799f182bd0969ec7b930bf59
|
data/README.md
CHANGED
@@ -56,12 +56,6 @@ class ExampleTest < ActionDispatch::IntegrationTest
|
|
56
56
|
assert_broadcast_on("messages:#{room.id}", text: 'Hello!') do
|
57
57
|
post "/say/#{room.id}", xhr: true, params: { message: 'Hello!' }
|
58
58
|
end
|
59
|
-
|
60
|
-
# When testing broadcast to an object outside of channel test,
|
61
|
-
# channel should be explicitly specified
|
62
|
-
assert_broadcast_on(room, { text: 'Hello!' }, { channel: ChatChannel } do
|
63
|
-
post "/say/#{room.id}", xhr: true, params: { message: 'Hello!' }
|
64
|
-
end
|
65
59
|
end
|
66
60
|
end
|
67
61
|
```
|
@@ -131,8 +125,6 @@ When broadcasting to an object:
|
|
131
125
|
|
132
126
|
```ruby
|
133
127
|
class ChatChannelTest < ActionCable::Channel::TestCase
|
134
|
-
include ActionCable::TestHelper
|
135
|
-
|
136
128
|
def setup
|
137
129
|
@room = Room.find 1
|
138
130
|
|
@@ -140,7 +132,7 @@ class ChatChannelTest < ActionCable::Channel::TestCase
|
|
140
132
|
subscribe room_number: room.id
|
141
133
|
end
|
142
134
|
|
143
|
-
def
|
135
|
+
def test_broadcasting
|
144
136
|
assert_broadcasts(@room, 1) do
|
145
137
|
perform :speak, message: "I'm here!"
|
146
138
|
end
|
@@ -207,6 +207,12 @@ module ActionCable
|
|
207
207
|
@subscription
|
208
208
|
end
|
209
209
|
|
210
|
+
# Unsubscribe the subscription under test.
|
211
|
+
def unsubscribe
|
212
|
+
check_subscribed!
|
213
|
+
subscription.unsubscribe_from_channel
|
214
|
+
end
|
215
|
+
|
210
216
|
# Perform action on a channel.
|
211
217
|
#
|
212
218
|
# NOTE: Must be subscribed.
|
@@ -38,10 +38,15 @@ module ActionCable
|
|
38
38
|
attr_reader :cookie_jar
|
39
39
|
|
40
40
|
module CookiesStub
|
41
|
-
# Stub signed cookies
|
41
|
+
# Stub signed cookies
|
42
42
|
def signed
|
43
43
|
self
|
44
44
|
end
|
45
|
+
|
46
|
+
# Stub encrypted cookies
|
47
|
+
def encrypted
|
48
|
+
self
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
def cookie_jar=(val)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "action_cable/subscription_adapter/async"
|
4
|
+
|
3
5
|
module ActionCable
|
4
6
|
module SubscriptionAdapter
|
5
7
|
# == Test adapter for Action Cable
|
@@ -8,9 +10,13 @@ module ActionCable
|
|
8
10
|
# <tt>ActionCable::TestHelper</tt> it makes a great tool to test your Rails application.
|
9
11
|
#
|
10
12
|
# To use the test adapter set adapter value to +test+ in your +cable.yml+.
|
11
|
-
|
13
|
+
#
|
14
|
+
# NOTE: Test adapter extends the <tt>ActionCable::SubscriptionsAdapter::Async</tt> adapter,
|
15
|
+
# so it could be used in system tests too.
|
16
|
+
class Test < Async
|
12
17
|
def broadcast(channel, payload)
|
13
18
|
broadcasts(channel) << payload
|
19
|
+
super
|
14
20
|
end
|
15
21
|
|
16
22
|
def broadcasts(channel)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action-cable-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 3.1.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 3.1.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.14.6
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.14.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.7.
|
186
|
+
rubygems_version: 2.7.7
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: Testing utils for Action Cable
|