action-cable-testing 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf3abddc511003c6b27b53426346450ac8d01b14cd7b07efa362a0919e640cbc
|
4
|
+
data.tar.gz: 62b4274b443cfad8364f2e740882a9771a1cd527256a2abed10cb49d4342e9d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0169abf3201a897f56801df818e73642bafd570d20e71619900678753f838c163d06837b01fad907f4ebbf644c20e6050ad0df2e2d577646c62d6019cf7cc58
|
7
|
+
data.tar.gz: 1b8c8724a8e713cb8f1a01a99c8415a522d7ac16a01fe64bc5097a8e67eaa6bd850e0f43a7bd8eee4867b1d36906aa07c848c6895d9c5e04296788911ab07b12
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -120,17 +120,23 @@ class ChatChannelTest < ActionCable::Channel::TestCase
|
|
120
120
|
assert_has_stream "chat_1"
|
121
121
|
|
122
122
|
# Asserts that the channel subscribes connection to a stream created with `stream_for`
|
123
|
-
|
123
|
+
assert_has_stream_for Room.find(1)
|
124
124
|
end
|
125
|
-
|
126
|
-
def
|
125
|
+
|
126
|
+
def test_subscribed_without_room_number
|
127
127
|
subscribe
|
128
|
+
|
129
|
+
assert subscription.confirmed?
|
130
|
+
# Asserts that no streams was started
|
131
|
+
# (e.g., we want to subscribe later by performing an action)
|
132
|
+
assert_no_streams
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_does_not_subscribe_with_invalid_room_number
|
136
|
+
subscribe room_number: -1
|
128
137
|
|
129
138
|
# Asserts that the subscription was rejected
|
130
139
|
assert subscription.rejected?
|
131
|
-
|
132
|
-
# Asserts that no streams was started
|
133
|
-
assert_no_streams
|
134
140
|
end
|
135
141
|
end
|
136
142
|
```
|
@@ -294,13 +300,20 @@ RSpec.describe ChatChannel, type: :channel do
|
|
294
300
|
# initialize connection with identifiers
|
295
301
|
stub_connection user_id: user.id
|
296
302
|
end
|
297
|
-
|
298
|
-
it "
|
303
|
+
|
304
|
+
it "subscribes without streams when no room id" do
|
299
305
|
subscribe
|
300
|
-
|
306
|
+
|
307
|
+
expect(subscription).to be_confirmed
|
301
308
|
expect(subscription).not_to have_streams
|
302
309
|
end
|
303
310
|
|
311
|
+
it "rejects when room id is invalid" do
|
312
|
+
subscribe(room_id: -1)
|
313
|
+
|
314
|
+
expect(subscription).to be_rejected
|
315
|
+
end
|
316
|
+
|
304
317
|
it "subscribes to a stream when room id is provided" do
|
305
318
|
subscribe(room_id: 42)
|
306
319
|
|
@@ -193,7 +193,7 @@ module ActionCable
|
|
193
193
|
|
194
194
|
connection = self.class.connection_class.allocate
|
195
195
|
connection.singleton_class.include(TestConnection)
|
196
|
-
connection.send(:initialize, build_test_request(path, request_params))
|
196
|
+
connection.send(:initialize, build_test_request(path, **request_params))
|
197
197
|
connection.connect if connection.respond_to?(:connect)
|
198
198
|
|
199
199
|
# Only set instance variable if connected successfully
|
@@ -17,10 +17,10 @@ module RSpec
|
|
17
17
|
set_expected_number(:exactly, 1)
|
18
18
|
end
|
19
19
|
|
20
|
-
def with(data = nil)
|
20
|
+
def with(data = nil, &block)
|
21
21
|
@data = data
|
22
22
|
@data = @data.with_indifferent_access if @data.is_a?(Hash)
|
23
|
-
@block =
|
23
|
+
@block = block if block_given?
|
24
24
|
self
|
25
25
|
end
|
26
26
|
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
|
-
rubygems_version: 3.0.
|
188
|
+
rubygems_version: 3.0.6
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: Testing utils for Action Cable
|