Ruby: Testing with RSpec
6h 14mIntermediate2015-02-04
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Learn how to use RSpec, the Ruby testing framework that can help developers be more productive, write better code, and reduce bugs during development. Kevin Skoglund explains the basic syntax of RSpec and then dives straight into writing and running test examples. He shows how to use a variety of matchers to test for expected conditions, provides techniques for testing efficiently, and demonstrates how test doubles can stand in for objects and methods. He also explains the additional RSpec features available for Ruby on Rails, and walks through a step-by-step example of test-driven development.
Learning objectives
Installing and configuring RSpec
Writing and running examples
Defining expectations using matchers
Using helper methods, before/after hooks, and shared examples
Creating test doubles using mocks and stubs
Testing Ruby on Rails with RSpec
Putting test-driven development into practice
Learning objectives
Installing and configuring RSpec
Writing and running examples
Defining expectations using matchers
Using helper methods, before/after hooks, and shared examples
Creating test doubles using mocks and stubs
Testing Ruby on Rails with RSpec
Putting test-driven development into practice
Skills covered
RubySoftware TestingOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Welcome
- 02 - How to use the exercise files
1. Introducing RSpec
- 03 - What is RSpec
- 04 - Why software tests are important
- 05 - Thinking in user stories
- 06 - Writing good tests
2. Installation
- 07 - Installing Ruby and RubyGems
- 08 - Installing RSpec
- 09 - Configuration
3. First Steps and Concepts
- 10 - Target code and the spec file
- 11 - Basic syntax
- 12 - Writing specs
- 13 - Running specs
- 14 - Skipping examples and working with pending examples
4. Working with Expectations
- 15 - Fundamentals
- 16 - A deprecated modifier - should
- 17 - Equivalence matchers
- 18 - Truthiness matchers
- 19 - Numeric comparison matchers
- 20 - Collections
- 21 - Other useful matchers
- 22 - Predicate matchers
- 23 - Observation matchers
- 24 - Complex expectations
5. Testing Efficiently
- 25 - Helper methods
- 26 - Hooks - before, after, and around
- 27 - Using the let method
- 28 - Setting a subject
- 29 - Implicitly defined subjects
- 30 - Shared examples
6. Test Doubles
- 31 - What are test doubles
- 32 - Using mocks and stubs
- 33 - Partial test doubles
- 34 - Message expectations
- 35 - Message argument constraints
- 36 - Message count constraints
- 37 - Spies
7. Challenges
- 38 - Food-finder application
- 39 - Challenge - NumberHelper
- 40 - Solution - NumberHelper
- 41 - Challenge - StringExtend
- 42 - Solution - StringExtend
- 43 - Challenge - Restaurant
- 44 - Solution - Restaurant
- 45 - Challenge - Guide
- 46 - Solution - Guide
8. RSpec with Ruby on Rails
- 47 - Installing
- 48 - Generators
- 49 - Test database
- 50 - Transactional examples
- 51 - Model specs
- 52 - Helper specs
- 53 - Controller specs - Requests
- 54 - Controller specs - Responses
- 55 - View specs
9. Test-Driven Development (TDD)
- 56 - What is TDD
- 57 - A TDD example - Part one
- 58 - A TDD example - Part two
- 59 - A TDD example - Part three
- 60 - A TDD example - Part four
- 61 - Benefits and disadvantages
10. Testing Tools
- 62 - Fixtures and factories
- 63 - Acceptance testing
- 64 - Automatic testing
- 65 - Other tools
Conclusion
- 66 - Goodbye
Related courses
- Mobile Testing with Appium
- Advanced Selenium: Automation Frameworks
- Installing and Running Ruby on Rails 5: Windows
- Learning Chef
- CompTIA PenTest+ (PT0-001): 6 Using Scripting in Pen Testing
- CompTIA PenTest+ (PT0-002) Cert Prep: 5 Tools and Code Analysis
- Ruby on Rails: Get More From ActiveRecord
- Ruby Essential Training Part 3: Files, Formats, Templates
Related learn paths
- Build Your Ruby on Rails Skills
- Getting Started with Continuous Integration / Continuous Delivery (CI/CD)
- Getting Started with DevOps
- Getting Started with C++
- Prepare for the CompTIA PenTest+ (PT0-001) Exam
- Prepare for the CompTIA PenTest+ (PT0-002) Certification Exam
- Become a Programmer: Foundations
- Getting Started with R for Data Science