aprescott/sidekiq-symbols — pull request #6 by aprescott (2014-12-19 23:58:26+00:00)
Title: [WIP] Replace prepend implementation and allow better subclass functionality

* [ ] Wait for a Sidekiq release later than 3.3.0.

This addresses #3.

As of mperham/sidekiq#1943, a couple of things need to change in the implementation and in the tests.

The first is that `prepend` is no longer necessary, because `execute_job` is now a level of indirection that sits in front of `perform`. The `execute_job` method is intended to provide a wrapper around `perform` so that modifications can be made. This gem provides such a modification, so implementation is somewhat cleaner.

The second change is to the tests. Previously, we were calling `.perform` directly in order to verify that the `perform` call was modifying code. Since the new code is now testing that `execute_job` is modifying the arguments passed to `perform`, this test is unnecessary.

This commit also removes the requirement that every job class `include Sidekiq::Symbols`, even if a parent class already did it. Say you have this structure:

```ruby
class ApplicationJob
include Sidekiq::Worker
include Sidekiq::Symbols

# ...
end

class FooJob < ApplicationJob
def perform(x: 1)
# ...
end
end
```

Enqueueing a job for `FooJob` would _not_ allow symbol usage in the existing, previous implementation, because `ApplicationJob` is the class that `Sidekiq::Symbols` was prepended in front of.

```
ApplicationJob
|
Sidekiq::Symbols
|
FooJob
```

Soo `FooJob` (and every other subclass of `ApplicationJob`) had to explicitly duplicate the `include Sidekiq::Symbols` line.

With the new implementation, there is no `prepend`ed module, and instead `ApplicationJob` defines its own `execute_job`, which every subclass will also use.

This helps address #2.