Testing Ruby with RSpec: The Complete Guide

Video Description

Master the art of test-driven development in Ruby using the popular RSpec Gem. No previous testing experience is needed!

About This Video

  • Master the syntax and structure of RSpec, the most popular Ruby Gem for testing
  • Explore the wide collection of RSpec matches available to test your code

In Detail

This course offers a comprehensive overview of the RSpec testing library for the Ruby programming library. RSpec is the most popular Ruby Gem of all time, with over 300 million downloads to date. If you're new to the topic, testing is the practice of writing code that confirms that other code works as expected. Tests control for regressions, which are changes to the code that break the program.

The benefits of testing extend beyond the codebase. Adopting a test-driven approach will also make you a better developer. Tests force you to think critically about a program and its features: classes, objects, methods and more.

Testing Ruby with RSpec: The Complete Guide begins with the essentials and proceeds to more complex topics, including:

  • Installation
  • Project initialization
  • Test-Driven Development (TDD)
  • let variables
  • before and after hooks
  • Subjects
  • Shared examples
  • Shared context
  • Built-in matchers
  • Mocks and doubles
  • Instance doubles
  • Class doubles

At the completion of this course, you'll have acquired hands-on Ruby testing experience with this awesome RSpec library

Table of Contents

  1. Chapter 1 : Introduction
    1. Welcome to RSpec 00:13:03
    2. Unit Tests vs End-to-End (E2E) Tests 00:09:17
    3. Installing RSpec 00:03:12
    4. Starting a Project with rspec --init 00:10:18
    5. Test-Driven Development 00:05:29
    6. The describe Method 00:04:42
    7. The it Method 00:05:33
    8. The expect and eq Methods 00:08:02
    9. Reading Failures 00:07:30
    10. Making the Specs Pass 00:08:58
    11. Multiple Examples in Example Group 00:08:01
    12. Fixing Failing Specs Again 00:08:23
    13. Reducing Duplication - Before Hooks and Instance Variables 00:10:59
    14. Reducing Duplication: Helper Methods 00:04:12
    15. Problems With Mutation 00:06:04
    16. Reducing Duplication: The let Method 00:15:06
    17. Custom Error Messages 00:04:40
    18. The context Method and Nested Describes 00:08:18
    19. before and after Hooks 00:09:07
    20. Nested Logic: Hooks 00:12:00
    21. Nested Logic: Overwriting Let Variables 00:08:53
  2. Chapter 2 : Subjects, Shared Examples, and Shared Context
    1. Implicit Subject 00:07:37
    2. Explicit Subject 00:05:39
    3. described_class 00:06:13
    4. One-Liner-Example-Syntax 00:05:08
    5. Shared Examples with include_examples 00:10:12
    6. Shared Context with include_context 00:07:34
  3. Chapter 3 : Built-In Matchers
    1. The not_to Method 00:04:39
    2. Equality Matchers I (eq and eql) 00:05:31
    3. Equality Matchers II (equal and be) 00:09:51
    4. Comparison Matchers 00:06:03
    5. Predicate Matchers 00:07:46
    6. all Matcher 00:06:21
    7. be Matcher (Truthy, Falsy and Nil Values) 00:07:24
    8. change Matcher 00:10:02
    9. contain_exactly Matcher 00:04:07
    10. start_with and end_with Matchers 00:06:01
    11. have_attributes Matcher 00:04:36
    12. include Matcher 00:06:17
    13. raise_error Matcher 00:09:11
    14. respond_to Matcher 00:09:02
    15. satisfy Matcher 00:09:42
    16. not_to Method 00:08:22
    17. Compound Expectations 00:06:17
  4. Chapter 4 : Mocks
    1. Create a Test Double 00:15:37
    2. Set up Our Test Movie 00:08:45
    3. Replacing an Object with a Double 00:12:32
    4. Receive Counts 00:07:27
    5. The allow Method 00:11:48
    6. Matching Arguments 00:10:33
    7. Instance Doubles 00:13:37
    8. Class Doubles 00:13:24
    9. Spies I 00:08:16
    10. Spies II 00:09:44
  5. Chapter 5 : Conclusion
    1. Conclusion 00:00:32

Product Information

  • Title: Testing Ruby with RSpec: The Complete Guide
  • Author(s): Boris Paskhaver
  • Release date: August 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781839219474