Module: RSpec::Rails::ChannelExampleGroup
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionCable::Channel::TestCase::Behavior, ActionCable::Connection::TestCase::Behavior, RailsExampleGroup
- Defined in:
- lib/rspec/rails/example/channel_example_group.rb,
lib/rspec/rails/example/channel_example_group.rb
Overview
Container module for channel spec functionality. It is only available if ActionCable has been loaded before it.
Instance Method Summary collapse
-
#have_rejected_connection ⇒ Object
Checks that the connection attempt has been rejected.
-
#have_stream_for(object) ⇒ Object
Checks that the channel has been subscribed to a stream for the given model.
-
#have_stream_from(stream) ⇒ Object
Checks that the channel has been subscribed to the given stream.
-
#have_streams ⇒ Object
Checks that the subscription is subscribed to at least one stream.
Instance Method Details
#have_rejected_connection ⇒ Object
Checks that the connection attempt has been rejected.
58 59 60 |
# 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) ⇒ Object
Checks that the channel has been subscribed to a stream for the given model
86 87 88 89 |
# 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) ⇒ Object
Checks that the channel has been subscribed to the given stream
76 77 78 79 80 |
# 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 ⇒ Object
Checks that the subscription is subscribed to at least one stream.
66 67 68 69 70 |
# File 'lib/rspec/rails/example/channel_example_group.rb', line 66 def have_streams check_subscribed! RSpec::Rails::Matchers::ActionCable::HaveStream.new end |