Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capture_turbo_stream_broadcast test helper #690

Closed

Conversation

seanpdoyle
Copy link
Contributor

Follow-up to #466

Introduce the #capture_turbo_stream_broadcast helper to serve as a shortcut invocation for #capture_turbo_stream_broadcasts. It returns a single value, instead of an Array.

The benefit is that assertions that only need to make an assertion about a single element are not required to deconstruct the Array value to access the first element.

Follow-up to [hotwired#466][]

Introduce the `#capture_turbo_stream_broadcast` helper to serve as a
shortcut invocation for `#capture_turbo_stream_broadcasts`. It returns
*a single* value, instead of an Array.

The benefit is that assertions that only need to make an assertion about
a single element are not required to deconstruct the `Array` value to
access the first element.

[hotwired#466]: hotwired#466
@dhh
Copy link
Member

dhh commented Oct 5, 2024

Hmm, I'm not sure this is worth it. Maybe we can just add this example:

      #     replace = capture_turbo_stream_broadcasts "messages" do
      #       message.broadcast_replace
      #     end.first

Or similar.

@dhh dhh closed this Oct 5, 2024
@seanpdoyle seanpdoyle deleted the single_capture_stream_broadcast branch October 5, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants