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

feature request: negative matchers #224

Open
stevecrozz opened this issue Jul 17, 2024 · 3 comments
Open

feature request: negative matchers #224

stevecrozz opened this issue Jul 17, 2024 · 3 comments

Comments

@stevecrozz
Copy link

Trying to assert some method does not enqueue either of two sidekiq jobs, and I get this message from rspec:

  1) MyClass does not enqueue either job
     Failure/Error: 
       expect { my_method }
         .not_to(
           enqueue_sidekiq_job(JobOne)
           .and enqueue_sidekiq_job(JobTwo)
         )

     NotImplementedError:
       `expect(...).not_to matcher.and matcher` is not supported, since it creates a bit of an ambiguity. Instead, define negated versions of whatever matchers you wish to negate with `RSpec::Matchers.define_negated_matcher` and use `expect(...).to matcher.and matcher`.

It would be a nice feature to have negative matchers like not_enqueue_sidekiq_job for this use case.

@wspurgin
Copy link
Owner

Definitely seems like something we could add and a good first issue for someone (since it's easy to define the negative version with RSpec::Matchers.define_negated_matcher). Good suggestion!

@manovasanth1227
Copy link

I would like to work on this issue. can you please assign it to me ? @wspurgin

@wspurgin
Copy link
Owner

@manovasanth1227 feel free to open a PR! No issue assignment necessary!

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

No branches or pull requests

3 participants