method

assert_no_broadcasts

Importance_1
v7.0.0 - Show latest stable - 0 notes - Class: TestHelper
assert_no_broadcasts(stream, &block) public

Asserts that no messages have been sent to the stream.

def test_no_broadcasts
  assert_no_broadcasts 'messages'
  ActionCable.server.broadcast 'messages', { text: 'hi' }
  assert_broadcasts 'messages', 1
end

If a block is passed, that block should not cause any message to be sent.

def test_broadcasts_again
  assert_no_broadcasts 'messages' do
    # No job messages should be sent from this block
  end
end

Note: This assertion is simply a shortcut for:

assert_broadcasts 'messages', 0, &block
Show source
Register or log in to add new notes.