-
Alex Ghiculescu authored
This PR is similar to https://github.com/rails/rails/pull/47025, it makes Action Cable's `assert_broadcasts` return the messages that were broadast. This way you can do more analysis on them: ```ruby messages = assert_broadcasts("test", 2) do ActionCable.server.broadcast "test", { message: "one" } ActionCable.server.broadcast "test", { message: "two" } end assert_equal 2, messages.length assert_equal({ "message" => "one" }, messages.first) assert_equal({ "message" => "two" }, messages.last) ``` This is helpful if you expect lots of messages to be broadcast or if you want to only match on some element of the data; `assert_broadcast_on` doesn't work well in either of those scenarios.
Alex Ghiculescu authoredThis PR is similar to https://github.com/rails/rails/pull/47025, it makes Action Cable's `assert_broadcasts` return the messages that were broadast. This way you can do more analysis on them: ```ruby messages = assert_broadcasts("test", 2) do ActionCable.server.broadcast "test", { message: "one" } ActionCable.server.broadcast "test", { message: "two" } end assert_equal 2, messages.length assert_equal({ "message" => "one" }, messages.first) assert_equal({ "message" => "two" }, messages.last) ``` This is helpful if you expect lots of messages to be broadcast or if you want to only match on some element of the data; `assert_broadcast_on` doesn't work well in either of those scenarios.
To find the state of this project's repository at the time of any of these versions, check out the tags.
Loading