shlogg · Early preview
Jetthoughts Dev @jetthoughts

Simplifying Stream Testing With Assert_has_no_stream Methods

New Ruby on Rails methods `assert_has_no_stream` & `assert_has_no_stream_for` simplify testing stopped streams, making tests more reliable and easier to maintain.

Previously, developers encountered a significant challenge verifying if streams ceased operation correctly. This issue often led to the creation of intricate workarounds or the omission of proper testing.

  
  
  The Old Way

Here's an e­xample:

assert_not ActionCable.server.pubsub.redis_connection_for_subscriptions.subscribed_to?("messages")

    
    

    
    




This code­ works but isn't straightforward to update.

  
  
  The New Solution

The following Ruby on Rails introduces assert_has_no_stream and assert_has_no_stream_for. These new methods simplify the testing of stopped stream...