module Minitest::Rails::Expectations::ActionCable::Connection

Public Instance Methods

must_reject_connection() click to toggle source

Asserts that the connection is rejected (via reject_unauthorized_connection).

describe "Application Connections", :connection do
  it "connects with proper cookie" do
    # Simulate the connection request with a cookie.
    cookies["user_id"] = users(:john).id

    connect

    # Assert the connection identifier matches the fixture.
    value(connection.user.id).must_equal users(:john).id
  end

  it "rejects connection without proper cookie" do
    must_reject_connection { connect }
  end
end

See also ActionCable::Connection::TestCase#assert_reject_connection See api.rubyonrails.org/v6.0/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection

# File lib/minitest/rails/expectations/action_cable.rb, line 173
extend ::ActiveSupport::Concern