RSpec: Best Practices by Carbon Five

I have been focusing on RSpec lately, using it for my projects and taking the Efficient TDD course at Blazing Cloud. Although I prefer textbooks to the Internets for coding advice, the Carbon Five community site is an exception and contains useful bits such as their post on RSpec Best Practices.

The post reinforces what I am learning in the class regarding readability, formatting, and applying the DRY (Don’t Repeat Yourself) principle my spec files.

Benefits of cleaner, well-organize tests include:

  • Saves Code: Know exactly what is being tested so that both the test and code are following DRY.
  • Better Test Cases: Assertions and expectations are explicit so tests are written for specific scenarios vs. basic test coverage.
  • Readability: Test output is readable at run-time.

Thanks again to Carbon Five for the write-up, and I hope to share more test code soon.

Leave a Comment

CommentLuv badge
Performance Optimization WordPress Plugins by W3 EDGE