This article introduces how to install ActiveJob using Sidekiq in Rails.
Install Redis on macOS by Homebrew:
brew install redis
Install Redis on Linux(CentOS) by
yum or etc:
sudo yum install -y redis
Add some gem names to
Gemfile. After then, please execute
bundle install in terminal.
# Job queue
config.active_job.queue_adapter = :sidekiq
Please add & edit
After then, you can see sidekiq admin page from http://localhost:3000/sidekiq.
rails g job hoge
after then, please edit job file.
class HogeJob < ActiveJob::Base
If you want to call the job function, please write the follow.
If you want to add authentication with Devise, please add
You can run a process of sidekiq by as follows:
bundle exec sidekiq -C config/sidekiq.yml
Before you write RSpec for the above job, you should set configuration to
RSpec.configure do |config|
Now, you can write RSpec for the Job in
spec/jobs/example_job_spec.rb like this:
- Testing Rails ActiveJob with RSpec — Medium
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!