Releases: wspurgin/rspec-sidekiq
v5.0.0
Breaking ❗
have_enqueued_sidekiq_job()
matches jobs with any arguments (same asenqueue_sidekiq_job()
orhave_enqueued_sidekiq_job(any_args)
). Previously it would only match jobs with no args (#215)
New features ✨
You can now specify the number of jobs that should match the expectation! Thanks you @3v0k4 for the much requested feature!
Use via one of the following chainable methods:
#once
#twice
#thrice
#exactly(n)
#at_least(n)
#at_most(n)
Examples:
expect(AwesomeJob).to have_enqueued_sidekiq_job.once
expect(AwesomeJob).to have_enqueued_sidekiq_job.exactly(1).time
expect(AwesomeJob).to have_enqueued_sidekiq_job.exactly(:once)
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_least(1).time
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_least(:once)
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_most(2).times
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_most(:twice)
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_most(:thrice)
PR Changelog
- Support
have_enqueued_sidekiq_job
with no args by @3v0k4 in #215 - Support expected counts by @3v0k4 in #219
- Prep for 5.0 release by @wspurgin in #218
Full Changelog: v4.2.0...v5.0.0
As always, bug reports and additions are always most welcome!
v4.2.0
v4.1.0
What's Changed
- added required_ruby_version >= 2.7 into gemspec by @skunkworker in #209
- Add "immediately" matcher by @chrismaximin in #210
- Include composable module in base matcher by @wspurgin in #211
New Contributors
- @skunkworker made their first contribution in #209
- @chrismaximin made their first contribution in #210
Full Changelog: v4.0.2...v4.1.0
v4.0.2
v4 - We have a release! 🚀
This repo was in ownership limbo for a few years, but now it's getting some TLC. v4 aims to squish some long standing bugs and add a few nice features we've been missing.
All feedback and bug reports are also most welcome. 😄
Summary of changes
BREAKING Changes
- Dropped support for Rubies < 2.7
- Dropped support for Sidekiq <5
- Dropped support for Rails <5
- Drop
have_enqueued_job
matcher - Mocking
Sidekiq::Pro
'sSidekiq::Batches
is now opt-in and disabled by default
New features
Block syntax 🤙
Many examples in the README, but here's a teaser:
expect { AwesomeJob.perform_async "Awesome!" }.to enqueue_sidekiq_job(AwesomeJob).with("Awesome!")
#on
chainable matcher ⛓️
Wanna test which queue your job was enqueued on? Go for it:
# Both block style and yee old have_enqueued_sidekiq_job style supports it
expect { AwesomeJob.set(queue: "high").perform_async }.to enqueue_sidekiq_job(AwesomeJob).on("high")
expect(AwesomeJob).to have_enqueued_sidekiq_job.on("high")
RSpec builtin args matchers 🙌
Finally you can use those lovely builtin Args matchers from rspec-mocks
expect {
AwesomeJob.perform_async({ "important_arg" => true })
}.to enqueue_sidekiq_job(AwesomeJob).with(hash_including("important_arg" => boolean))
# or using the non-block style
expect(AwesomeJob).to have_enqueued_sidekiq_job(hash_including("important_arg" => boolean))
PR list
Many other bug fixes, and enhancements have gone into v4 as well. Here's all the PRs.
- 👋 Hi I'm the new maintainer by @wspurgin in #190
- Support Sidekiq 7 by @wspurgin in #192
- Update Batches mocking to be opt-in by @wspurgin in #193
- Correct evaluation for "in" option by @wspurgin in #194
- Update failure message to list out actual jobs line-by-line by @wspurgin in #195
- Ignore argument check when expected_arguments empty by @teckwan in #196
- Add
#on
matcher by @wspurgin in #197 - 🐛 Fix be_delayed interval calculation by @wspurgin in #198
- Remove have_enqueued_job and rename files/class by @wspurgin in #199
- Use ArgumentListMatcher to ensure order and allow use of richer builtin Argument matchers by @wspurgin in #200
- Block syntax
enqueue_sidekiq_job
by @wspurgin in #201
v4.0.1
- Restore normalizing args to fix unintentional breaking change with symbols #205
v4.0.2
- Explicitly require
forwardable
#204
New Contributors
- @wspurgin made their first contribution in #190
- @teckwan made their first contribution in #196
- @ksss made their first contribution in #204
Full Changelog: v3.1.0...v4.0.2
4.0.0.pre
v4.0.0.pre - We have a (pre)release! 🚀
What needs testing in the wild
I personally don't use ActiveJob
basically at all in any project where I use Sidekiq. This is mostly just from longstanding habit since Sidekiq 5 and the known performance drops one encountered when using ActiveJob
as a middle-man.
As such, I don't have a place to play around with how testing ActiveJob
with v4 works (or doesn't!). If anyone uses ActiveJob
with Sidekiq and uses this repo for testing your Sidekiq-ery, please give this prerelease a try and send in issues and feedback.
For all other plain-ol' Sidekiq users, your feedback and bug reports are also most welcome. 😄
v3.1.0
3.1.0
- Add support for latest ruby and Rails 5 (coding-bunny #156)
- Support
Class#method
notation in batch callback (caalberts #155) - Fix bug with time comparison in delayed jobs (geeosh #153 with help from col)
- remove usage of
Integer#blank?
(lanej #152) - Add
NullBatch#description
(dsantosmerino #139) - README updates (BenMusch #142, akihikodaki #141, wpolicarpo #160)
3.0.3
Tick to 3.0.3 Also includes changes from CHANGES.md for 3.0.2, which were forgotten
3.0.2
3.0.1
- Remove implicit runtime dependency on ActiveSupport [aprescott#109]
3.0.0
- Use default arguments for NullStatus initialization [briansharon#111]
- Fix at and in chainable methods [wpolicarpo#109]
- Rely on all of RSpec in development [packrat386#101]
- Pass exception to within_sidekiq_retries_exhausted_block [packrat386#100]
- Add support for testing scheduled jobs [wpolicarpo#81]
- only depend on rspec-core [urkle#96]
- Add support for Sidekiq Enterprise [Geesu#82]
- Fix clash with rspec-rails [pavel-jurasek-bcgdv-com#95]