A large part of my application relies on background jobs to process user's websites, so I need to write some tests to cover these.
First question is how to test code that's in a Sidekiq worker class, for example app/workers/some_worker.rb
class SomeWorker
include Sidekiq::Worker
def perform(model_id)
...
end
end
Secondly, how do I stub code such as the following so I don't need to actually run workers and slow down my tests?
response = HTTParty.get("http://users-site.com", timeout: 30)
Read the Testing page in the Sidekiq wiki.