February 2018
Intermediate to advanced
406 pages
9h 52m
English
This is the best general piece of advice I can give about the style and structure of automated tests: Your code is verified by your tests, but your tests are verified by nothing. Having your tests be as clear and as manageable as possible is the best way to keep them honest.
| Prescription 10 | Your tests are also code. Specifically, your tests are code that does not have tests. |
In practice this means avoiding complex metaprogramming or loops in test code that might make it challenging to understand and evaluate test failure. One thing you might be tempted to do from time to time is invoke RSpec it methods inside a loop. This is a bad idea. Even though handling very similar logic in separate tests seems like more code, giving each test ...