module RSpec::Rails::ChannelExampleGroup

def have_rejected_connection

expect { connect }.to have_rejected_connection
@example

Checks that the connection attempt has been rejected.
def have_rejected_connection
  raise_error(::ActionCable::Connection::Authorization::UnauthorizedError)
end