English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

How To Use Rake to Run Your Test Suite with Sinatra


If you're using Sinatra and you want to use rake to run your test suite, you will need to create a Rakefile and put this in it.

require 'rake/testtask'

task :default do
  ENV['RACK_ENV'] = 'test'

Rake::TestTask.new(:default) do |t|
  t.libs << "test"
  t.pattern = 'test/*_test.rb'
  t.verbose = true

This assumes your test suite is under the 'test/' directory and the files you want to test match the '_test.rb' pattern.

Now you can run rake from the command line and the default task (your test suite) will execute!

Tagged w/ #sinatra #rake #testing