Skip to content

Commit 523f869

Browse files
committed
Rename #assert_not_has_stream #assert_has_no_stream
This is a follow-up to rails#50585. I propose to provide smoother reading experiences with the two methods introduced in there, `#assert_not_has_stream` and `#assert_not_has_stream_for`, by renaming them `#assert_has_no_stream` and `#assert_has_no_stream_for`, respectively.
1 parent a2ed343 commit 523f869

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

actioncable/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
* Add two new assertion methods for ActionCable test cases: `assert_not_has_stream`
2-
and `assert_not_has_stream_for`. These methods can be used to assert that a
1+
* Add two new assertion methods for ActionCable test cases: `assert_has_no_stream`
2+
and `assert_has_no_stream_for`. These methods can be used to assert that a
33
stream has been stopped, e.g. via `stop_stream` or `stop_stream_for`. They complement
44
the already existing `assert_has_stream` and `assert_has_stream_for` methods.
55

66
```ruby
7-
assert_not_has_stream "messages"
8-
assert_not_has_stream_for User.find(42)
7+
assert_has_no_stream "messages"
8+
assert_has_no_stream_for User.find(42)
99
```
1010

11-
*Sebastian Pöll*
11+
*Sebastian Pöll*, *Junichi Sato*
1212

1313
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actioncable/CHANGELOG.md) for previous changes.

actioncable/lib/action_cable/channel/test_case.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,24 +314,24 @@ def assert_has_stream_for(object)
314314

315315
# Asserts that the specified stream has not been started.
316316
#
317-
# def test_assert_not_started_stream
317+
# def test_assert_no_started_stream
318318
# subscribe
319-
# assert_not_has_stream 'messages'
319+
# assert_has_no_stream 'messages'
320320
# end
321321
#
322-
def assert_not_has_stream(stream)
322+
def assert_has_no_stream(stream)
323323
assert subscription.streams.exclude?(stream), "Stream #{stream} has been started"
324324
end
325325

326326
# Asserts that the specified stream for a model has not started.
327327
#
328-
# def test_assert_not_started_stream_for
328+
# def test_assert_no_started_stream_for
329329
# subscribe id: 41
330-
# assert_not_has_stream_for User.find(42)
330+
# assert_has_no_stream_for User.find(42)
331331
# end
332332
#
333-
def assert_not_has_stream_for(object)
334-
assert_not_has_stream(broadcasting_for(object))
333+
def assert_has_no_stream_for(object)
334+
assert_has_no_stream(broadcasting_for(object))
335335
end
336336

337337
private

actioncable/test/channel/test_case_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ def test_not_stream_without_params
111111
subscribe
112112
unsubscribe
113113

114-
assert_not_has_stream "test_0"
114+
assert_has_no_stream "test_0"
115115
end
116116

117117
def test_not_stream_with_params
118118
subscribe id: 42
119119
perform :unsubscribed, id: 42
120120

121-
assert_not_has_stream "test_42"
121+
assert_has_no_stream "test_42"
122122
end
123123

124124
def test_unsubscribe_from_stream
@@ -150,7 +150,7 @@ def test_not_stream_with_params
150150
subscribe id: 42
151151
perform :unsubscribed, id: 42
152152

153-
assert_not_has_stream_for User.new(42)
153+
assert_has_no_stream_for User.new(42)
154154
end
155155
end
156156

0 commit comments

Comments
 (0)