Namespace
Methods
- A
- P
- S
- T
- U
Included Modules
Constants
CHANNEL_IDENTIFIER | = | "test_stub" |
Instance Public methods
assert_broadcast_on(stream_or_object, *args) Link
assert_broadcasts(stream_or_object, *args) Link
Enhance TestHelper
assertions to handle non-String broadcastings
assert_has_stream(stream) Link
Asserts that the specified stream has been started.
def test_assert_started_stream
subscribe
assert_has_stream 'messages'
end
assert_has_stream_for(object) Link
Asserts that the specified stream for a model has started.
def test_assert_started_stream_for
subscribe id: 42
assert_has_stream_for User.find(42)
end
assert_no_streams() Link
Asserts that no streams have been started.
def test_assert_no_started_stream
subscribe
assert_no_streams
end
perform(action, data = {}) Link
Perform action on a channel.
NOTE: Must be subscribed.
stub_connection(identifiers = {}) Link
Set up test connection with the specified identifiers:
class ApplicationCable < ActionCable::Connection::Base
identified_by :user, :token
end
stub_connection(user: users[:john], token: 'my-secret-token')
subscribe(params = {}) Link
Subscribe to the channel under test. Optionally pass subscription parameters as a Hash
.
# File actioncable/lib/action_cable/channel/test_case.rb, line 239 def subscribe(params = {}) @connection ||= stub_connection @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access) @subscription.singleton_class.include(ChannelStub) @subscription.subscribe_to_channel @subscription end
transmissions() Link
Returns messages transmitted into channel