Rails 6 API Tutorial - RSpec API Tests POST/DELETE p.10
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:30 - Wrap tests for each controller/action in their own 'describe' block
01:08 - Add a 'describe' block to test the create controller/action
02:25 - Add an 'it' block to test the creating a new book
02:30 - Make POST request with API params
03:56 - Add an assertion to check that response code is 201
04:31 - Add an assertion to check that a record was created in the database, using RSpec 'to change'
05:58 - Add a 'describe' and 'it' block to test the destroy controller/action
06:50 - Make DELETE request with record ID
07:10 - Add an assertion to check that response code is 204
07:26 - Add FactoryBot call so there is a database record to delete
08:31 - Remove hardcoded ID by assigning the FactoryBot record to a variable
09:20 - Improve the specs using RSpec let
10:31 - Add an assertion to check that a record was deleted from the database, using RSpec 'to change'
11:32 - Using RSpec let! to ensure database record is created before the test gets executed
12:18 - Refactoring test setup using 'before do'
If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8
⭐️Get early access to my in-depth Rails API tutorial: https://gumroad.com/l/ruby-on-rails-api-tutorial
☎️ Book a slot for 1-to-1 help or pair programming: https://superpeer.com/tomkadwill/-/rails-api-consulting
? Hire me or discuss a project: [email protected]
? If you find this useful and want to support the channel, please consider a small donation. Thank you! https://buymeacoff.ee/tomkadwill
Twitter: https://twitter.com/tomkadwill
Blog: http://tomkadwill.com
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Rails 6 API Tutorial - RSpec API Tests POST/DELETE p.10», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.