Module: RSpec::Rails::ChannelExampleGroup::ClassMethods
| Relationships & Source Files | |
| Defined in: | rspec-rails/lib/rspec/rails/example/channel_example_group.rb, rspec-rails/lib/rspec/rails/example/channel_example_group.rb |
Overview
Class-level DSL for channel specs.
Instance Method Summary
- #channel_class Internal use only
-
#connection_class
:nocov:
- #check_class_type!(klass, type, ancestor) private
Instance Method Details
#channel_class
[ GitHub ]# File 'rspec-rails/lib/rspec/rails/example/channel_example_group.rb', line 32
def channel_class (_channel_class || described_class).tap { |klass| check_class_type!(klass, "channel", ::ActionCable::Channel::Base) } end
#check_class_type!(klass, type, ancestor) (private)
[ GitHub ]# File 'rspec-rails/lib/rspec/rails/example/channel_example_group.rb', line 53
def check_class_type!(klass, type, ancestor) return true if klass && klass <= ancestor raise "Described class is not a #{type} class.\n" \ "Specify the #{type} class in the `describe` statement " \ "or set it manually using `tests My#{type.capitialize}Class`" end
#connection_class
:nocov:
See additional method definition at line 39.
# File 'rspec-rails/lib/rspec/rails/example/channel_example_group.rb', line 45
def connection_class (super || described_class).tap { |klass| check_class_type!(klass, "connection", ::ActionCable::Connection::Base) } end