actioncable-next 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +11 -0
- data/lib/action_cable/connection/base.rb +11 -0
- data/lib/action_cable/engine.rb +6 -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 +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b86ee72b0095c7a8ce99b0d354231b2ac29145e07a1482387fa9664f1c9a08b8
|
4
|
+
data.tar.gz: e72beed883e8789189fa6811d6fb70cdc4e9efbec2ad9b259648c8575196aca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 955b568fb0d4e01d81ad6871292515c1a3d742eef03067c6322d68b7c6908eeac12947aaef91cb9d4fcbccf2e3790ff84c797ad30e462db15179b04ee6a2d8a3
|
7
|
+
data.tar.gz: 3cc6151d155e3719b008bad22ecf4fbf0a401a5858a7ef5bd75a941debca5b26ac9d06cb30d781929d6da10399c9f534d06aed6ac7afd2ea7a96490066dc6891
|
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
|
+
```
|
@@ -162,4 +162,15 @@ module ActionCable
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
+
# Hack to make sure legacy extensions do not changes the visibility of API methods
|
166
|
+
# (see https://github.com/anycable/actioncable-next/issues/7)
|
167
|
+
# We call it from the engine after application initialization.
|
168
|
+
class << ActionCable::Connection::Base
|
169
|
+
def __restore_visibility__
|
170
|
+
%i[handle_open handle_close handle_channel_command transmit close].each do |method|
|
171
|
+
instance_method(method).owner.send(:public, method)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
165
176
|
ActiveSupport.run_load_hooks(:action_cable_connection, ActionCable::Connection::Base)
|
data/lib/action_cable/engine.rb
CHANGED
@@ -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,16 +1,16 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pratik Naik
|
8
8
|
- David Heinemeier Hansson
|
9
9
|
- Vladimir Dementyev
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -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,10 +167,10 @@ 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.2/CHANGELOG.md
|
170
171
|
source_code_uri: https://github.com/anycable/actioncable-next
|
171
172
|
rubygems_mfa_required: 'true'
|
172
|
-
post_install_message:
|
173
|
+
post_install_message:
|
173
174
|
rdoc_options: []
|
174
175
|
require_paths:
|
175
176
|
- lib
|
@@ -184,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
185
|
- !ruby/object:Gem::Version
|
185
186
|
version: '0'
|
186
187
|
requirements: []
|
187
|
-
rubygems_version: 3.5.
|
188
|
-
signing_key:
|
188
|
+
rubygems_version: 3.5.22
|
189
|
+
signing_key:
|
189
190
|
specification_version: 4
|
190
191
|
summary: Next-gen version of Action Cable
|
191
192
|
test_files: []
|