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: 4685e6b9a972c44862aaa6fe59c4454c93d4557cbad57bd1a2eefdf9e9f6e572
4
- data.tar.gz: e3ca2c5959b3f55032da62efabd94ff7829e724957acb2cf67b94b98fd4c9771
3
+ metadata.gz: bf3abddc511003c6b27b53426346450ac8d01b14cd7b07efa362a0919e640cbc
4
+ data.tar.gz: 62b4274b443cfad8364f2e740882a9771a1cd527256a2abed10cb49d4342e9d5
5
5
  SHA512:
6
- metadata.gz: 0764c04d9aad6eb8eaa6a890c9e442053db169f1ec0676b00f45dc8e7345268c2688adad1db6afba1496f43d7e1e8e362cf366d66c75939dab402414734673d6
7
- data.tar.gz: f2fe591556834380e989906a906bf2ba1a298098aa02675e4aa99a9b353902dd7cb775ca37a8fd60a44947c51d71bc6b1344358538d29b55700234e010c343d5
6
+ metadata.gz: e0169abf3201a897f56801df818e73642bafd570d20e71619900678753f838c163d06837b01fad907f4ebbf644c20e6050ad0df2e2d577646c62d6019cf7cc58
7
+ data.tar.gz: 1b8c8724a8e713cb8f1a01a99c8415a522d7ac16a01fe64bc5097a8e67eaa6bd850e0f43a7bd8eee4867b1d36906aa07c848c6895d9c5e04296788911ab07b12
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 0.6.1 (2020-03-02)
4
+
5
+ - Fix Ruby 2.7 warnings. ([@palkan][])
6
+
3
7
  ## 0.6.0 (2019-08-19)
4
8
 
5
9
  - **Ruby 2.4+** is required.
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
- assert_has_stream_for Room.find(1)
123
+ assert_has_stream_for Room.find(1)
124
124
  end
125
-
126
- def test_does_not_subscribe_without_room_number
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 "rejects when no room id" do
303
+
304
+ it "subscribes without streams when no room id" do
299
305
  subscribe
300
- expect(subscription).to be_rejected
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActionCable
4
4
  module Testing
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
@@ -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 = Proc.new if block_given?
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.0
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: 2019-08-20 00:00:00.000000000 Z
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.4
188
+ rubygems_version: 3.0.6
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Testing utils for Action Cable