* Refactor CLI test
Extracted 3 main parts:
- parse
- run
- signal handling
* Move demonization and pid write from parse to run phase
* Move queues default from validate to setup options phase
* Add pry-byebug gem
* Drop Sidekiq::Test
* Require launcher in CLI
* Remove TODOs
Situation:
We are using Sidekiq Pro with ActiveSupport.
When I passed a object which is ActiveSupport::TimeWithZone to perform_at,
`TypeError: can't convert ActiveSupport::TimeWithZone into an exact
number` has occurred.
Problem:
Time can't plus a ActiveSupport::TimeWithZone object.
Solution:
We can transform any Time object to float, and use it to compare and
calculate.
At the moment, `MyWorker.perform_in(1.month)` always schedules a job in 30
days. When added to a date, `1.month` will add 1 to the date's month count,
which means that it will add 28, 29, 30, or 31 days depending on the month and
year.
When I call `MyWorker.perform_in(1.month)`, I would expect the job to be
scheduled next month, same day of the month, all the time. At the moment, it is
true only four months in the year.
My pull request tries to fix this by converting the interval object to a Float
at the last possible moment.
Plaese note that the test I wrote will fail only during months that do not have
30 days. Ideally, I would add a dependency to Timecop and freeze time to any
day in a month of 28, 29 or 31 days. This could also avoid using
`#assert_in_delta`, in favour of `#assert_equal`.
Feel free to read my blog post [Rails' `1.month` has a variable
length](http://dstosik.github.io/rails/2015/02/19/rails-1month-variable-length/)
for more details.
Redis#zadd will return a boolean value when only one item is added. This
was failing to be equal to 1, and caused any Sidekiq::Client::push
invocations with an 'at' value to return false, even if they
successfully were stored into redis.