wspurgin / rspec-sidekiq

RSpec for Sidekiq
https://github.com/wspurgin/rspec-sidekiq
Other
655 stars 132 forks source link

feature request: negative matchers #224

Open stevecrozz opened 2 months ago

stevecrozz commented 2 months ago

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 commented 2 months ago

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 commented 1 week ago

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

wspurgin commented 1 week ago

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