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
Source
# File lib/rspec/rails/example/channel_example_group.rb, line 58 def have_rejected_connection raise_error(::ActionCable::Connection::Authorization::UnauthorizedError) end
Checks that the connection attempt has been rejected.
@example
expect { connect }.to have_rejected_connection
Source
# 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
Checks that the channel has been subscribed to a stream for the given model
@example
expect(subscription).to have_stream_for(user)
Source
# 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
Checks that the channel has been subscribed to the given stream
@example
expect(subscription).to have_stream_from("chat_1")
Source
# File lib/rspec/rails/example/channel_example_group.rb, line 66 def have_streams check_subscribed! RSpec::Rails::Matchers::ActionCable::HaveStream.new end
Checks that the subscription is subscribed to at least one stream.
@example
expect(subscription).to have_streams