Rails 6 API Tutorial - Testing Active Job with RSpec p.17

Опубликовано: 29 Март 2026
на канале: Rails Pro
3,137
71

In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.

✨ Check out the new version of this video series, which has been updated for Rails 7    • Rails 7 API Tutorial - Create project and ...  

📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rail...

This video covers:
00:00 - Introduction
00:14 - Two places we should test an ActiveJob class
00:58 - Writing the ActiveJob specific test first in spec/jobs using perform_now
02:41 - Fixing bug with require 'net/http'
03:33 - Mocking the Net::HTTP call with RSpec allow
05:08 - Add expectation to check params are being passed correctly to Net::HTTP body
08:06 - Adding a controller test to ensure the ActiveJob class gets called
11:50 - Fixing bug with controller logic
12:26 - Making sure the controller test is working

If you’re new to this series, you may want to start with part 1:    • Rails 6 API Tutorial - Create project and ...