This course introduces you to Test-Driven Development (TDD) in Ruby, focusing on the Red-Green-Refactor cycle, embracing the TDD mindset, and setting up a productive environment with RSpec. You'll learn best practices like adhering to SOLID principles and utilizing dependency injection, while understanding TDD's influence on code quality and development speed compared to traditional methods.
Overview
Syllabus
- Unit 1: Introduction to Test Driven Development in Ruby
- Writing a Test for Non-Existent Method Using TDD
- Implement the Sum Function in Minimal TDD Style
- Refactoring the Sum Function
- Unit 2: Generalization in TDD with Ruby and RSpec
- Testing the Add Function in TDD Red Phase
- Transitioning to the Green Phase in TDD: Implementing the add_two_numbers Method
- Refactor Unit Tests to Use Parameterized Tests with RSpec
- Unit 3: Introduction to TDD with Ruby and RSpec: Building a `calculate_total` Method
- Writing Tests for Shopping Cart Calculation
- Implementing Calculate Total for Shopping Cart Task
- Shopping Cart Total Calculation Task
- Implement Initial Functionality for Calculate Total Function
- Refactor the calculate_total Method
- Crafting a Failing Test to Achieve TDD Mastery
- Calculate Total Cost of Shopping Cart
- Refactor to Use Ruby's Inject Method
- Unit 4: Setting Up a Ruby Testing Environment with RSpec
- Understanding RSpec with Asynchronous User Models
- Verify User Creation with RSpec
- Refactor Test Setup with RSpec's Let Method
- Grouping Email-Related Tests with Nested Describe Blocks in RSpec
- Test Invalid Email Throws Error in User Class
- Write an Asynchronous Test for Fetching User in Ruby
- Unit 5: Introduction to Managing Dependencies in TDD with Ruby
- Testing a UserManager with Red-Green-Refactor Approach
- Implementing a User Manager in Ruby
- Refactor Your Tests in UserManager Class
- Implementing a User Logging Feature with TDD in Ruby
- Implementing Logging with Dependency Injection in UserManager
- Refactoring UserManager for Code Quality
- Unit 6: Introduction to the AAA Pattern in TDD with Ruby and RSpec
- Refactoring TaskList Tests with AAA Pattern