9c5175e067
Previously, `ActionCable::Channel::ConnectionStub` would throw a `NoMethodError` when the channel under test calls `stop_stream_for`, as shown in the example below: ```ruby class ChatChannel < ActionCable::Channel::Base def subscribed stream_from "test" end def unsubscribed stop_stream_from "test" end end class ChatChannelTest < ActionCable::Channel::TestCase test "unsubscribe" do stub_connection subscribe # `unsubscribe` raises `NoMethodError` as `pubsub` does not exist on `ActionCable::Channel::ConnectionStub` unsubscribe assert_no_streams end end ``` Calling `unsubscribe` causes an exception as `stop_stream_from` calls `pubsub` when unsubscribing, which is not implemented in `ActionCable::Channel::ConnectionStub`. This commit fixes this issue by assigning the `ActionCable.server` singleton to a `@server` instance variable in `ActionCable::Channel::ConnectionStub`. This lets us delegate the `config` and `pubsub` method calls to it. |
||
---|---|---|
.. | ||
app | ||
bin | ||
lib | ||
test | ||
.babelrc | ||
.eslintrc | ||
.gitignore | ||
actioncable.gemspec | ||
CHANGELOG.md | ||
karma.conf.js | ||
MIT-LICENSE | ||
package.json | ||
Rakefile | ||
README.md | ||
rollup.config.js | ||
rollup.config.test.js |
Action Cable – Integrated WebSockets for \Rails
Action Cable seamlessly integrates WebSockets with the rest of your \Rails application. It allows for real-time features to be written in Ruby in the same style and form as the rest of your \Rails application, while still being performant and scalable. It's a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. You have access to your full domain model written with Active Record or your ORM of choice.
You can read more about Action Cable in the Action Cable Overview guide.
Support
API documentation is at:
Bug reports for the Ruby on \Rails project can be filed here:
Feature requests should be discussed on the rails-core mailing list here: