mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-03-15 18:55:56 +09:00
22 lines
547 B
Ruby
22 lines
547 B
Ruby
require "test_helper"
|
|
|
|
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
|
|
test "connects with valid user_id cookie" do
|
|
cookies.signed[:session_token] = sessions(:david_safari).token
|
|
|
|
connect
|
|
|
|
assert_equal users(:david), connection.current_user
|
|
end
|
|
|
|
test "rejects connection with missing user_id cookie" do
|
|
assert_reject_connection { connect }
|
|
end
|
|
|
|
test "rejects connection with invalid user_id cookie" do
|
|
cookies.signed[:session_token] = -1
|
|
|
|
assert_reject_connection { connect }
|
|
end
|
|
end
|