0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
0
+# This is based on Florian Weber's TDDMate
0
+ def run(argv, stderr, stdout)
0
+ base = ActiveRecord::Base
0
+ def base.clear_reloadable_connections!
0
+ active_connections.each do |name, conn|
0
+ if conn.requires_reloading?
0
+ active_connections.delete(name)
0
+ if ::Dispatcher.respond_to?(:cleanup_application)
0
+ ::Dispatcher.cleanup_application
0
+ elsif ::Dispatcher.respond_to?(:reset_application!)
0
+ ::Dispatcher.reset_application!
0
+ ::Dependencies.mechanism = :load
0
+ require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
0
+ load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
0
+ ::Spec::Runner::CommandLine.run(
0
+ ::Spec::Runner::OptionParser.parse(
0
+puts "Loading Rails environment"
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+def restart_test_server
0
+ config = ::Config::CONFIG
0
+ ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
0
+ command_line = [ruby, $0, ARGV].flatten.join(' ')
0
+def daemonize(pid_file = nil)
0
+ return yield if $DEBUG
0
+ trap("SIGINT"){ exit! 0 }
0
+ trap("SIGTERM"){ exit! 0 }
0
+ trap("SIGHUP"){ restart_test_server }
0
+ File.open("/dev/null"){|f|
0
+ puts "spec_server launched. (PID: %d)" % pid
0
+ File.open(pid_file,"w"){|f| f.puts pid } if pid_file
0
+opts = OptionParser.new
0
+opts.on("-d", "--daemon"){|v| options[:daemon] = true }
0
+opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
0
+ trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
0
+ DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
0
+ daemonize(options[:pid], &exec_server)
Comments
No one has commented yet.