{"id":14991370,"url":"https://github.com/inkstak/rspec-sidekiq_pro","last_synced_at":"2026-03-03T10:33:34.921Z","repository":{"id":57750581,"uuid":"523653219","full_name":"inkstak/rspec-sidekiq_pro","owner":"inkstak","description":"A collection of RSpec matchers for Sidekiq Pro","archived":false,"fork":false,"pushed_at":"2025-06-06T08:18:10.000Z","size":44,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T20:30:41.596Z","etag":null,"topics":["rspec","ruby","sidekiq"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inkstak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-11T08:59:42.000Z","updated_at":"2025-06-06T08:18:13.000Z","dependencies_parsed_at":"2024-09-11T22:36:29.717Z","dependency_job_id":"a142f542-0a87-430b-9e10-d48bd4347d63","html_url":"https://github.com/inkstak/rspec-sidekiq_pro","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"b8702a09e095ccd5638bec6cabdecb20ed840dc9"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/inkstak/rspec-sidekiq_pro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkstak%2Frspec-sidekiq_pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkstak%2Frspec-sidekiq_pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkstak%2Frspec-sidekiq_pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkstak%2Frspec-sidekiq_pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inkstak","download_url":"https://codeload.github.com/inkstak/rspec-sidekiq_pro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkstak%2Frspec-sidekiq_pro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30041288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T10:28:37.494Z","status":"ssl_error","status_checked_at":"2026-03-03T10:28:28.686Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rspec","ruby","sidekiq"],"created_at":"2024-09-24T14:27:33.554Z","updated_at":"2026-03-03T10:33:34.890Z","avatar_url":"https://github.com/inkstak.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec for Sidekiq Pro\n\n[![Gem Version](https://badge.fury.io/rb/rspec-sidekiq_pro.svg)](https://rubygems.org/gems/rspec-sidekiq_pro)\n[![CI Status](https://github.com/inkstak/rspec-sidekiq_pro/actions/workflows/ci.yml/badge.svg)](https://github.com/inkstak/rspec-sidekiq_pro/actions/workflows/ci.yml)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)\n[![Maintainability](https://api.codeclimate.com/v1/badges/3de8ad4b1787cdb9ca20/maintainability)](https://codeclimate.com/github/inkstak/rspec-sidekiq_pro/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/3de8ad4b1787cdb9ca20/test_coverage)](https://codeclimate.com/github/inkstak/rspec-sidekiq_pro/test_coverage)\n\n### Installation\n\n```bash\nbundle add rspec-sidekiq_pro --group=test\n```\n\n### Configuration\n\n`rspec/sidekiq_pro` requires `sidekiq/testing` by default so there is no need to include it.\n\nIt also means that Sidekiq in set to `fake` mode by default. Take a look at [Sidekiq wiki](https://github.com/mperham/sidekiq/wiki/Testing) for more details.\n\nIf you wish to start each spec without enqueued jobs or batches:\n\n```ruby\nrequire \"rspec/sidekiq_pro\"\n\nRSpec.configure do |config|\n  config.before do\n    Sidekiq::Queues.clear_all\n    RSpec::SidekiqPro::Batches.clear_all\n  end\nend\n```\n\n### Usage\n\nTwo matchers are provided:\n\n* `enqueue_sidekiq_job` supports block expectation\n* `have_enqueued_sidekiq_job` supports value expectation\n\n```ruby\nit do\n  expect { SampleJob.perform_async }.to enqueue_sidekiq_job(SampleJob)\nend\n```\n```ruby\nit do\n  SampleJob.perform_async\n  expect(SampleJob).to have_enqueued_sidekiq_job\nend\n```\n\nBoth matchers provide the same chainable methods:\n\n* `.with`\n* `.once`\n* `.twice`\n* `.exactly(n).times`\n* `.more_than(n).times`\n* `.less_than(n).times`\n* `.at_least(n).times`\n* `.at_most(n).times`\n* `.in`\n* `.at`\n* `.within_batch`\n* `.without_batch`\n\n\n#### Checking arguments\n\n```ruby\nit do\n  expect { SampleJob.perform_async(1, 2, 3) }\n    .to enqueue_sidekiq_job(SampleJob).with(1, 2, 3)\nend\n```\n```ruby\nit do\n  SampleJob.perform_async(1, 2, 3)\n  expect(SampleJob).to have_enqueued_sidekiq_job.with(1, 2, 3)\nend\n```\n\n\n#### Checking counts\n\n```ruby\nit do\n  expect { SampleJob.perform_async }\n    .to enqueue_sidekiq_job(SampleJob).once\nend\n```\n\n```ruby\nit do\n  expect { \n    2.times { SampleJob.perform_async }\n  }.to enqueue_sidekiq_job(SampleJob).twice\nend\n```\n\n```ruby\nit do\n  expect { \n    3.times { SampleJob.perform_async }\n  }.to enqueue_sidekiq_job(SampleJob).exactly(3).times\nend\n```\n\n```ruby\nit do\n  expect {\n    10.times { SampleJob.perform_async }\n  }.to enqueue_sidekiq_job(SampleJob).more_than(5).times\nend\n```\n\nBe careful when checking both counts and arguments:\n\n```ruby\nit do\n  expect { \n    SampleJob.perform_async.with(1)\n    SampleJob.perform_async.with(2)\n  } \n    .to  enqueue_sidekiq_job(SampleJob).twice\n    .and enqueue_sidekiq_job(SampleJob).once.with(1)\n    .and enqueue_sidekiq_job(SampleJob).once.with(2)\nend\n```\n\n#### Checking schedules\n\n```ruby\nit do\n  expect { \n    SampleJob.perform_in(5.minutes)\n  }.to enqueue_sidekiq_job(SampleJob).in(5.minutes)\nend\n```\n\n```ruby\nit do\n  expect { \n    SampleJob.perform_at(10.minutes.from_now)\n  }.to enqueue_sidekiq_job(SampleJob).at(10.minutes.from_now)\nend\n```\n\nTime matching is performed to the second, if you have code that takes some time to be executed consider using [Timecop](https://github.com/travisjeffery/timecop).\n\n\n#### Batches\n\n```ruby\nit do\n  expect { \n    SampleJob.perform_async\n  }.to enqueue_sidekiq_job(SampleJob).without_batch\nend\n```\n\n```ruby\nit do\n  expect { \n    batch = Sidekiq::Batch.new\n    batch.jobs { SampleJob.perform_async }\n  }.to enqueue_sidekiq_job(SampleJob).within_batch\nend\n```\n\n```ruby\nit do\n  expect { start_some_complex_workflow }\n    .to enqueue_sidekiq_job(SampleJob).twice.within_batch { |batch|\n      expect(batch).to have_attributes(description: \"Complex Workflow first step\")\n    }\nend\n```\n\n`within_batch` and `without_batch` require `Sidekiq::Testing` to be enabled.\n\nWhen `Sidekiq::Testing` is enabled, every batch is pushed to `RSpec::SidekiqPro::Batches` instead of Redis.\n\n```ruby\nit do\n  batch = Sidekiq::Batch.new\n  batch.jobs { SampleJob.perform_async }\n\n  expect(RSpec::SidekiqPro::Batches.first.bid).to eq(batch.bid)\nend\n```\n\n## Contributing\n\n1. Don't hesitate to submit your feature/idea/fix in [issues](https://github.com/inkstak/rspec-sidekiq_pro)\n2. Fork the [repository](https://github.com/inkstak/rspec-sidekiq_pro)\n3. Create your feature branch\n4. Ensure RSpec \u0026 Rubocop are passing\n4. Create a pull request\n\n### Tests \u0026 lint\n\n```bash\nbundle exec rspec\nbundle exec rubocop\nbundle exec standardrb\n```\n\nAll of them can be run with:\n\n```bash\nbundle exec rake\n```\n\n## License \u0026 credits\n\nPlease see [LICENSE](https://github.com/inkstak/rspec-sidekiq_pro/blob/main/LICENSE) for further details.\n\nInspired by the [philostler/rspec-sidekiq](https://github.com/philostler/rspec-sidekiq/) \u0026 [pirj/rspec-enqueue_sidekiq_job](https://github.com/pirj/rspec-enqueue_sidekiq_job)\n\nContributors: [./graphs/contributors](https://github.com/inkstak/rspec-sidekiq_pro/graphs/contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkstak%2Frspec-sidekiq_pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finkstak%2Frspec-sidekiq_pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkstak%2Frspec-sidekiq_pro/lists"}