module RSpec::Rails::ChannelExampleGroup
@api public Container module for channel spec functionality. It is only available if ActionCable has been loaded before it.
@api public Container module for channel spec functionality.
Public Instance Methods
have_rejected_connection()
click to toggle source
Checks that the connection attempt has been rejected.
@example
expect { connect }.to have_rejected_connection
# File lib/rspec/rails/example/channel_example_group.rb, line 58 def have_rejected_connection raise_error(::ActionCable::Connection::Authorization::UnauthorizedError) end
have_stream_for(object)
click to toggle source
Checks that the channel has been subscribed to a stream for the given model
@example
expect(subscription).to have_stream_for(user)
# File lib/rspec/rails/example/channel_example_group.rb, line 86 def have_stream_for(object) check_subscribed! RSpec::Rails::Matchers::ActionCable::HaveStream.new(broadcasting_for(object)) end
have_stream_from(stream)
click to toggle source
Checks that the channel has been subscribed to the given stream
@example
expect(subscription).to have_stream_from("chat_1")
# File lib/rspec/rails/example/channel_example_group.rb, line 76 def have_stream_from(stream) check_subscribed! RSpec::Rails::Matchers::ActionCable::HaveStream.new(stream) end
have_streams()
click to toggle source
Checks that the subscription is subscribed to at least one stream.
@example
expect(subscription).to have_streams
# File lib/rspec/rails/example/channel_example_group.rb, line 66 def have_streams check_subscribed! RSpec::Rails::Matchers::ActionCable::HaveStream.new end