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

preview_player
Показать описание
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.

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

Рекомендации по теме
Комментарии
Автор

Thanks man, this series helped me a lot ❤

ahmedmustafa
Автор

Tell me that you've done this for years without telling me that you've done this for years. More knowledge in this video than hundreds of others. You can't fake that.

n-at-han-k
Автор

Can you explain why if I put the assertion after the post, it fails? Thanks

OscarOliverah
Автор

wait so whats the diff between the controller test and the requests test?

iapplethis
Автор

interesting, so when testing in ruby you can mock code that is in the API that we are calling from inside the test? also how is rspec starting the app?

iapplethis