Skip to content

Add `not_publish_event` rspec matcher

Kassio Borges requested to merge kassio/add-not_published_event-matcher into master

What does this MR do and why?

Creates a not_publish_event matcher, for the Gitlab Event Store, to avoid multiple examples just to add more assertions for a test. I firstly faced that in in !98125 (merged), and decided extract the matcher in this single MR.

Example

    it 'does not create a pages domain and does not publish a PagesDomainCreatedEvent' do
      expect { service.execute }
        .to not_publish_event(PagesDomains::PagesDomainCreatedEvent)
        .and not_change(project.pages_domains, :count)
    end

Related to:

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