Created
February 11, 2019 10:07
-
-
Save gmaliar/721c359f41ef6d33691830e8762fde86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_broadcasts | |
| assert_broadcasts 'messages', 0 | |
| ActionCable.server.broadcast 'messages', { text: 'hello' } | |
| assert_broadcasts 'messages', 1 | |
| end | |
| def test_subscribed_with_room_number | |
| subscribe room_number: 1 | |
| assert subscription.confirmed? | |
| assert_has_stream "chat_1" | |
| assert_has_stream_for Room.find(1) | |
| end | |
| def test_perform_speak | |
| subscribe room_number: 1 | |
| perform :speak, message: "Hello, Rails!" | |
| assert_equal "Hello, Rails!", transmissions.last["text"] | |
| end | |
| def test_connects_with_cookies | |
| connect cookies: { user_id: users[:john].id } | |
| assert_equal "John", connection.user.name | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment