RSpec for Sidekiq Code Climate Travis CI Gemnasium

Simple testing of Sidekiq jobs via a collection of matchers and common tasks

RubyGems | Code Climate | GitHub | Travis CI | Gemnasium | RubyDoc | Ruby Toolbox

Installation

gem "rspec-sidekiq"

There is no need to require "sidekiq/testing" when using rspec-sidekiq

Configuration

RSpec::Sidekiq.configure do |config|
  # Clears all job queues before each example
  config.clear_all_enqueued_jobs = false # default => true
end

Matchers

be_processed_in

Describes the queue that the job should be processed in ruby it { should be_processed_in :download } } # one liner expect(AwesomeJob).to be_processed_in :download # new expect syntax

be_retryable

Describes if the job retries when there is a failure in it's execution ruby it { should be_retryable true } } # one liner expect(AwesomeJob).to be_retryable true # new expect syntax

be_unique (Only available when using sidekiq-middleware)

Describes if the job should be unique within it's queue ruby it { should be_unique } } # one liner expect(AwesomeJob).to be_unique # new expect syntax

have_enqueued_jobs

Evaluates the number of enqueued jobs for a specified job ruby expect(AwesomeJob).to have_enqueued_jobs(1) # new expect syntax

Testing

bundle exec rspec spec

Contribute

Yes do it! If there's a feature missing that you'd love them get in on the action!

Issues/Pull Requests/Comments bring them on...