How to use Mocks in Ruby Tests | Preview

Описание к видео How to use Mocks in Ruby Tests | Preview

► Check out https://gorails.com for Pro episodes and more!
► SaaS business template for Ruby on Rails with built-in features like Payments, Teams, and much more: https://jumpstartrails.com
► Ruby on Rails hosting with Hatchbox.io: https://hatchbox.io
► Learn how to add Stripe Payments (with SCA support!) with Ruby on Rails: https://courses.gorails.com/payments-...

Mocks are an invaluable tool when writing tests. You can use them to replace objects in your test suite so that you can verify your code calls specific methods against them. Mocks also let you stub methods against them just like with regular stubs.

Combine with Dependency Injection, mocks allow you to write tests with interchangeable dependencies. You can use a mock to simulate interaction with an API by creating a fake API as a mock.

Комментарии

Информация по комментариям в разработке