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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matcher for Channel.broadcast_to #9
Comments
Hi! I missed this 'cause I don't use What about making expect { perform :action }.to have_broadcasted_to(session)
# call WebNotificationsChannel.broadcasting_for([WebNotificationsChannel.channel_name, session]) under the hood |
That looks good. Thanks. And what to do in cases when |
Something like: expect { perform :action }.to have_broadcasted_to(session).from_channel(SomeChannel) |
Closed by #10 |
Hi 馃槂
Channels in ActionCable have
.broadcast_to
method (docs), which can be called both inside and outside of a channel. It also accepts object/record as a first argument. Right now there are a couple of ways to check that this method was called, but I think it'd be a good idea to add a matcher for it.Possible workarounds
Suggestions
have_broadcasted_to
matcher tohave_broadcasted
, and add above functionality tohave_broadcasted_to
.I think that will be more straightforward.
have_broadcasted
corresponds to#broadcast
andhave_broadcasted_to
corresponds to.broadcast_to
. However one is an instance method, while the other one is a class method. Maybe matchers should emphasize the difference.channel_broadcast_to
matcherThis one clearly states the distinction between methods. However, I don't think that it is as intuitive as an option above.
In both ways, though, I don't really know what would be a good syntax for specifying channel name.
What do you think?
The text was updated successfully, but these errors were encountered: