actioncable-next 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +11 -0
- data/lib/action_cable/next/rspec.rb +41 -0
- data/lib/action_cable.rb +1 -0
- data/lib/actioncable-next.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b463a6b0bafa3fa77350a4ff39ef12798703419107290828e932de40921150e
|
4
|
+
data.tar.gz: faf485a9167ab4d82c06fb5193ef8b8d6a17decc3096429e9432c2041a8482b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6686c1a5d31ec5b2867431612557ad4a0a3d13949b8876b42af43b96d87041bbb3a7df453c2b0db5f0231f6b71b0cee9376f1830c58e39aec87ecb52a41f22c
|
7
|
+
data.tar.gz: 46c4a80b030a7fc1e81383c8a4fd21fd3197c464965fbc2fb52e6f4a4fcec64b02b3f7d96b3efecaffbec811308d41aa678d0e30df8816743ec388d319d9ff9d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -15,3 +15,14 @@ gem "rails", "~> 7.0"
|
|
15
15
|
```
|
16
16
|
|
17
17
|
Then, you can use Action Cable as before. Under the hood, the new implementation would be used.
|
18
|
+
|
19
|
+
### RSpec support
|
20
|
+
|
21
|
+
This gem also includes the corresponding patch for RSpec Rails (see [PR](https://github.com/palkan/rspec-rails/pull/1)). You MUST activate it explicitly
|
22
|
+
by adding the following line to your `spec/rails_helper.rb`:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# after rspec-rails is loaded
|
26
|
+
require "rspec/rails"
|
27
|
+
require "action_cable/next/rspec"
|
28
|
+
```
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# RSpec patches from https://github.com/palkan/rspec-rails/pull/1
|
4
|
+
|
5
|
+
require "rspec/rails/example/channel_example_group"
|
6
|
+
|
7
|
+
if defined?(RSpec::Rails::ChannelExampleGroup)
|
8
|
+
RSpec::Rails::ChannelExampleGroup.prepend(Module.new do
|
9
|
+
def connection_class
|
10
|
+
(_connection_class || described_class).then do |klass|
|
11
|
+
# Connection class either specified explicitly or is a described class
|
12
|
+
next klass if klass && klass <= ::ActionCable::Connection::Base
|
13
|
+
|
14
|
+
# Otherwise, fallback to the default connection class
|
15
|
+
tests_connection ::ActionCable.server.config.connection_class.call
|
16
|
+
|
17
|
+
_connection_class
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end)
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec::Rails::Matchers::ActionCable::HaveStream.prepend(Module.new do
|
24
|
+
def match(subscription)
|
25
|
+
case subscription
|
26
|
+
when ::ActionCable::Channel::Base
|
27
|
+
@actual = streams_for(subscription)
|
28
|
+
no_expected? ? actual.any? : actual.any? { |i| expected === i }
|
29
|
+
else
|
30
|
+
raise ArgumentError, "have_stream, have_stream_from and have_stream_from support expectations on subscription only"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def streams_for(subscription)
|
36
|
+
# In Rails 8, subscription.streams returns a real subscriptions hash,
|
37
|
+
# not a fake array of stream names like in Rails 6-7.
|
38
|
+
# So, we must use #stream_names instead.
|
39
|
+
subscription.respond_to?(:stream_names) ? subscription.stream_names : subscription.streams
|
40
|
+
end
|
41
|
+
end)
|
data/lib/action_cable.rb
CHANGED
data/lib/actioncable-next.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actioncable-next
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pratik Naik
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/action_cable/engine.rb
|
126
126
|
- lib/action_cable/gem_version.rb
|
127
127
|
- lib/action_cable/helpers/action_cable_helper.rb
|
128
|
+
- lib/action_cable/next/rspec.rb
|
128
129
|
- lib/action_cable/remote_connections.rb
|
129
130
|
- lib/action_cable/server/base.rb
|
130
131
|
- lib/action_cable/server/broadcasting.rb
|
@@ -166,7 +167,7 @@ licenses:
|
|
166
167
|
- MIT
|
167
168
|
metadata:
|
168
169
|
bug_tracker_uri: https://github.com/anycable/actioncable-next
|
169
|
-
changelog_uri: https://github.com/anycable/actioncable-next/blob/v0.1.
|
170
|
+
changelog_uri: https://github.com/anycable/actioncable-next/blob/v0.1.1/CHANGELOG.md
|
170
171
|
source_code_uri: https://github.com/anycable/actioncable-next
|
171
172
|
rubygems_mfa_required: 'true'
|
172
173
|
post_install_message:
|