1. Introduction
- Confident testing
- Why Minitest?
- Who should read this book
- My testing philosophy
- How the book is organized
- Downloading the sample code
- Code conventions
- Discussion and errata
- A note about gem versions
- A note about styling
- About the sample application
2. Setting up Minitest
- Test database
- Clean the slate
- Nicer reporting
- Summary
- Exercises
3. Model tests
- Anatomy of a model test
- Creating a model test
- An aside on
test - More Minitest syntax
- Testing validations
- Testing instance methods
- Testing class methods and scopes
- Testing all the cases
- Summary
- Exercises
4. Keeping tests DRY
- DRYer test setup and teardown
- How DRY is too DRY?
- Summary
- Exercises
5. Test data with Rails defaults
- What are fixtures?
- Dynamic data inside fixtures
- Associating test data with other test data
- The problems with fixtures
- Fixtures: The good parts
- Summary
- Exercises
6. Test data with factories
- Installing factory_bot
- Adding factories to the application
- Generating unique data with sequences
- Associations in factories
- Using factories safely
- Summary
- Exercises
7. Integration tests, part 1
- Basic integration tests
- Testing user authentication
- Testing user authorization
- Testing user input
- Summary
- Exercises
8. Integration tests, part 2
- Testing invalid user input
- Simplifying test data with traits
- Testing non-HTML requests and responses
- The cost of test data
- Summary
- Exercises