O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

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

Running Minitest

Rails provides some standard Rake tasks for running all or part of the test suite.

The one to use most of the time, which is not the Rails default, is rake test:all; it grabs any files ending with _test.rb in the test directory or any of its subdirectories and executes them through Minitest. For running a single file, Minitest and Rails use the syntax open rake test test/models/task_test.rb. For now we’ll assume we’re using rake test:all. In Chapter 15, Running Tests Faster and Running Faster Tests, we’ll cover better ways to focus test execution.

When you run rake test:all, the Rake task identifies any files matching the pattern test/**/*_test.rb and passes them all to Minitest. (The related task rake test:all:db first ...

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