Running a single test - Ramaze/ramaze GitHub Wiki

When writing tests, it's not convenient to run the whole suite to see if it pass or not. If you set-up your test suite properly, requiring the right files in each spec file, you can make is easy to run running a single spec file.

For instance, you can crete a helper.rb file in specs/ like this :

require 'ramaze'
require 'ramaze/spec/bacon'

# Require you main app.rb file
# Even if you run your whole test suite, it will only be required one
require File.expand_path('../../app', __FILE__)

puts "Running specs using database #{DB.opts[:database]}\n"

Then, in each spec file, add (ruby 1.9.3+) :

require_relative './helper'

You can then execute your spec directly :

ruby myspec.rb