Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created October 17, 2010 12:59
Show Gist options
  • Save ayosec/630829 to your computer and use it in GitHub Desktop.
Save ayosec/630829 to your computer and use it in GitHub Desktop.
This scripts preloads the Rails environment, so you can run tests using "run 'test/unit/foo_test.rb'"
#!/usr/bin/ruby
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/application', __FILE__)
module Kernel
def run(test_file)
Process.waitpid(fork do
$: << File.dirname(__FILE__)+"/../test/"
load test_file
end)
end
end
puts 'Use run "test/path/file.rb"'
require 'irb'
IRB.start
# vim: syntax=ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment