O'Reilly logo

Effective Testing with RSpec 3 by Myron Marston, Ian Dees

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

Rake

Throughout this book, you’ve run your spec suite via the rspec command. But there’s another common way to run your specs: using the Rake build tool. The rspec-core gem ships with an easy-to-configure Rake task. To enable it, add the following two lines to your project’s Rakefile:

 require ​'rspec/core/rake_task'
 RSpec::Core::RakeTask.new(​:spec​)

This snippet defines a simple spec task that will run rspec with your configured defaults. You can then run it like so:

 $ ​​rake spec

Running RSpec this way adds some overhead. It takes time to load Rake itself, plus any libraries you need for other tasks in your Rakefile. A canned Rake task is also less flexible than the rspec command, ...

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