6. Testing

Program testing can be used to show the presence of bugs, but never to show their absence! – Edsger W. Dijkstra

Testing is an important part of software development, especially with dynamic languages like Ruby. Ensuring that our code works as specified is one of the most critical parts of building a successful product. Projects which don’t have tests often collapse under the uncertainty that small changes might introduce unwanted and unanticipated side effects.

Ruby comes with a testing framework in its standard library and there are many, many testing libraries available as Ruby Gems. This chapter will show you how to use these tools to write effective tests. While testing doesn’t offer proof that your code is free of bugs, it does ...

Get Effective Ruby: 48 Specific Ways to Write Better Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.