O'Reilly logo

Learning Rails: Live Edition by Edd Dumbill, Simon St. Laurent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beyond the Basics

Testing is central to Rails development, but virtually everyone has a different perspective on what they want from testing. While the tools demonstrated in this chapter provide a common core of functionality, many developers supplement or replace the testing approach built into Rails with other alternatives. If you want to explore further, these might be worth checking out:

autotest

The autotest plug-in (or zentest) runs tests for you in the background. It waits for you to make changes to code, then runs tests addressing the files that changed. For an introduction, see http://ph7spot.com/articles/getting_started_with_autotest.

mocha

The mocha plug-in provides an extensive toolkit for letting your tests call methods that you’ve overridden, guaranteeing that your tests will operate against a consistent set of interactions—even if you haven’t really implemented those parts of your application yet. For more information, see http://mocha.rubyforge.org/.

rcov

Testing is great, but what if your tests only cover part of your code and don’t actually try out the broken parts? rcov lets you see which parts of your code are actually covered by your tests. To learn more about code coverage and rcov, see http://eigenclass.org/hiki.rb?rcov.

RSpec

RSpec takes testing to a totally different level, letting you create stories with your code, testing the results of those stories in a way that lets you see what was supposed to happen and what did or didn’t happen as well. It makes it much ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required