Skip to content

More detailed event store spec failure message

Kassio Borges requested to merge kassio/better-event-store-spec-message into master

What does this MR do and why?

This changes the event store publish_event rspec matcher failure message to be more descriptive.

When there's no event matching, instead of getting the published events in an array, like:

expected Pages::PageDeployedEvent with {:project_id=>242, :namespace_id=>719, :root_namespace_id=>719} to be published, but got [#<Pages::PageDeletedEvent data: {:project_id=>242, :namespace_id=>719, :root_namespace_id=>719}>]

We'll get all published events in a list format:

expected Pages::PageDeployedEvent with {:project_id=>243, :namespace_id=>721, :root_namespace_id=>721} to be published, but only the following events were published:
- #<Pages::PageDeletedEvent data: {:project_id=>243, :namespace_id=>721, :root_namespace_id=>721}>

And, when no event was published, instead of an empty array:

expected Pages::PageDeployedEvent with {:project_id=>242, :namespace_id=>719, :root_namespace_id=>719} to be published, but got []

we'll get the description that no events were published:

expected Pages::PageDeployedEvent with {:project_id=>244, :namespace_id=>723, :root_namespace_id=>723} to be published, but no events were published.

Also, inspecting an event doesn't show its memory address to have a more concise information in the screen.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kassio Borges

Merge request reports