timecop
                                
                                 timecop copied to clipboard
                                
                                    timecop copied to clipboard
                            
                            
                            
                        how to work with sidekiq?
Timecop.freeze(Time.now + 1.hours) do
  ExpiredReserveWorker.perform_async
end
This above code not work
Do you want to schedule a work to a sidekiq?
yes, I have a sidekiq worker depend on time changes, I am writing a rspec with this gem to test this worker
You have to use perform_in sidekiq method.
I used perform_in(59.minutes) and after that ran Timecop.travel(1.hour) but the sidekiq task does not get executed :( - any ideas?
Probably because it writes to redis time that are going to happen in the future, but the sidekiq knows nothing about the time travel thing, as it works with redis commands, instead of ruby environment.
@rgaufman I would just write smaller unit tests. So for your thing enqueues a job (e.g. similar to https://github.com/mperham/sidekiq/wiki/Testing#testing-worker-queueing-fake), for example if you had a process that does MyWorker.perform_in(59.minutes), ensure that after it runs your MyWorker.jobs.size is one higher, but doesn't really care what MyWorker actually does. Then in another spec like myworker_spec.rb, have it just test #perform.