When beginning to learn Ruby, I never came across RSpec in the list of buzzwords and acronyms associated with programming. With my first exposure to RSpec and the concept of Test Driven Development, I was a bit confused about what the purpose was. When writing methods, I assumed calling methods gave all of the testing necessary to know that your program works. RSpec, I’ve learned, goes beyond that.
Jason Arhart’s RSpec for Beginners presentation for the Las Vegas Ruby Group givens a concise yet comprehensive overview of what the purpose of using RSpec tests is. The point that really stuck with me is the idea of “focus on the what before the how”. One of the things I’m making a conscious effort to practice while learning to code is to slow down, think methodically, and break down each necessarly step. Writing RSpec tests is one way to do this. In order to write an effective RSpec test, you must know first what you’re program needs to do. This must be done before the how<.
Another thing Jason focuses on in his presentation is how RSpec tests account of expected behavior. We talk about this sometimes in class, and it’s one thing I like to think about when programming: it’s important to account for all the things a user might do with your program. I like to think about these things while programming because one of the most exciting things about coding for me is the idea of my products being used by others and how they use them; RSpec testing creates a comprehensive way of testing for all of those different user possibilities.