method
capture_broadcasts
v7.1.3.2 -
Show latest stable
- Class:
ActionCable::TestHelper
capture_broadcasts(stream, &block)public
Returns the messages that are broadcasted in the block.
def test_broadcasts messages = capture_broadcasts('messages') do ActionCable.server.broadcast 'messages', { text: 'hi' } ActionCable.server.broadcast 'messages', { text: 'how are you?' } end assert_equal 2, messages.length assert_equal({ text: 'hi' }, messages.first) assert_equal({ text: 'how are you?' }, messages.last) end