form26/sidekiq-unique-jobs — pull request #25 by liveh2o (2013-11-18 01:10:15+00:00)
Title: Don't connect to Redis when sidekiq/testing is loaded

When sidekiq/testing is loaded, Sidekiq doesn't attempt to connect to Redis, so it isn't required to be running when tests/specs are run (see #18). Since unique jobs checking is dependent on connecting to Redis, it either needs to be mocked or disabled during spec runs. This cut simply disables unique job checking when `Sidekiq::Testing` is enabled.

The tests were a bit tricky to setup, so I ended breaking up the the `#call` method into several smaller methods including a `#unique?` predicate method that handles checking if the job being queued is unique. The test helper now loads sidekiq/testing and I added Mocha as a development dependency to provide testing coverage for this new functionality.

The specs are passing, so assuming this follows your coding standards and the general spirit of the library, it should be good to go. Just let me know if you'd like anything changed.