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

Emitter test from README not working properly #3

Open
ikowasz opened this issue Jun 20, 2022 · 0 comments
Open

Emitter test from README not working properly #3

ikowasz opened this issue Jun 20, 2022 · 0 comments

Comments

@ikowasz
Copy link

ikowasz commented Jun 20, 2022

Hello there!

It seems that there is a mistake in testing publishers part of readme.

Using .to broadcast with just the event name works perfectly, but declaring any arguments results in missing event_uid error.

Example:

    it 'emits vessels__comment_created' do
      user = create :user
      vessel = create :vessel
      expect {
        VesselComment.create!(user: user, vessel: vessel, message: 'New comment')
      }.to broadcast(:vessels__comment_created, comment_id: fetch_next_id_for(VesselComment))
    end

error:

expected publisher to broadcast vessels__comment_created event with args: [{:comment_id=>14}] (actual events broadcast: vessels__comment_created({:comment_id=>14, :event_uid=>"7ad49ddea66b5805-ORIGIN-39c2bf7c9bcfc428"}))
Diff:
@@ -1 +1 @@
-[[{:comment_id=>14}]]
+[[{:comment_id=>14, :event_uid=>"7ad49ddea66b5805-ORIGIN-39c2bf7c9bcfc428"}]]

It's worth noting that adding event_uid: anything to the broadcast's matcher parameters fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant