Skip to content

Emitter test from README not working properly #3

Open
@ikowasz

Description

@ikowasz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions