| |   |
| 1 | 1 | #!/usr/bin/env ruby |
| 2 | 2 | $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib")) |
| 3 | 3 | require 'spec' |
| 4 | | ::Spec::Runner::CommandLine.run(ARGV, STDERR, STDOUT, true, true) |
| 4 | exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT)) |
| toggle raw diff |
--- a/script/spec
+++ b/script/spec
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
require 'spec'
-::Spec::Runner::CommandLine.run(ARGV, STDERR, STDOUT, true, true)
+exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT)) |
| |   |
| 6 | 6 | require 'rbconfig' |
| 7 | 7 | require 'spec' |
| 8 | 8 | require 'optparse' |
| 9 | | specmate = ENV['HOME'] + "/Library/Application\ Support/TextMate/Bundles/RSpec.tmbundle/Support/lib" |
| 10 | | if File.directory?(specmate) |
| 11 | | $LOAD_PATH.unshift(specmate) |
| 12 | | require 'text_mate_formatter' |
| 13 | | end |
| 14 | 9 | |
| 15 | 10 | # This is based on Florian Weber's TDDMate |
| 16 | | |
| 17 | 11 | module Spec |
| 18 | 12 | module Runner |
| 19 | 13 | class RailsSpecServer |
| 20 | | def run(args, stderr, stdout) |
| 21 | | $stdout = stdout |
| 22 | | $stderr = stderr |
| 14 | def run(argv, stderr, stdout) |
| 15 | $stdout = stdout |
| 16 | $stderr = stderr |
| 17 | |
| 18 | base = ActiveRecord::Base |
| 19 | def base.clear_reloadable_connections! |
| 20 | active_connections.each do |name, conn| |
| 21 | if conn.requires_reloading? |
| 22 | conn.disconnect! |
| 23 | active_connections.delete(name) |
| 24 | end |
| 25 | end |
| 26 | end |
| 23 | 27 | |
| 24 | | ::Dispatcher.reset_application! |
| 28 | if ::Dispatcher.respond_to?(:cleanup_application) |
| 29 | ::Dispatcher.cleanup_application |
| 30 | elsif ::Dispatcher.respond_to?(:reset_application!) |
| 31 | ::Dispatcher.reset_application! |
| 32 | end |
| 25 | 33 | ::Dependencies.mechanism = :load |
| 26 | 34 | require_dependency('application.rb') unless Object.const_defined?(:ApplicationController) |
| 27 | 35 | load File.dirname(__FILE__) + '/../spec/spec_helper.rb' |
| 28 | | |
| 29 | | ::Spec::Runner::CommandLine.run(args, stderr, stdout, false, true) |
| 36 | |
| 37 | ::Spec::Runner::CommandLine.run( |
| 38 | ::Spec::Runner::OptionParser.parse( |
| 39 | argv, |
| 40 | $stderr, |
| 41 | $stdout |
| 42 | ) |
| 43 | ) |
| 30 | 44 | end |
| 31 | 45 | end |
| 32 | 46 | end |
| … | … | |
| 57 | 57 | ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT'] |
| 58 | 58 | command_line = [ruby, $0, ARGV].flatten.join(' ') |
| 59 | 59 | exec(command_line) |
| 60 | | end |
| 60 | end |
| 61 | 61 | |
| 62 | 62 | def daemonize(pid_file = nil) |
| 63 | 63 | return yield if $DEBUG |
| … | … | |
| 97 | 97 | else |
| 98 | 98 | exec_server.call |
| 99 | 99 | end |
| 100 | | |
| toggle raw diff |
--- a/script/spec_server
+++ b/script/spec_server
@@ -6,27 +6,41 @@ require 'drb/drb'
require 'rbconfig'
require 'spec'
require 'optparse'
-specmate = ENV['HOME'] + "/Library/Application\ Support/TextMate/Bundles/RSpec.tmbundle/Support/lib"
-if File.directory?(specmate)
- $LOAD_PATH.unshift(specmate)
- require 'text_mate_formatter'
-end
# This is based on Florian Weber's TDDMate
-
module Spec
module Runner
class RailsSpecServer
- def run(args, stderr, stdout)
- $stdout = stdout
- $stderr = stderr
+ def run(argv, stderr, stdout)
+ $stdout = stdout
+ $stderr = stderr
+
+ base = ActiveRecord::Base
+ def base.clear_reloadable_connections!
+ active_connections.each do |name, conn|
+ if conn.requires_reloading?
+ conn.disconnect!
+ active_connections.delete(name)
+ end
+ end
+ end
- ::Dispatcher.reset_application!
+ if ::Dispatcher.respond_to?(:cleanup_application)
+ ::Dispatcher.cleanup_application
+ elsif ::Dispatcher.respond_to?(:reset_application!)
+ ::Dispatcher.reset_application!
+ end
::Dependencies.mechanism = :load
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
-
- ::Spec::Runner::CommandLine.run(args, stderr, stdout, false, true)
+
+ ::Spec::Runner::CommandLine.run(
+ ::Spec::Runner::OptionParser.parse(
+ argv,
+ $stderr,
+ $stdout
+ )
+ )
end
end
end
@@ -43,7 +57,7 @@ def restart_test_server
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
command_line = [ruby, $0, ARGV].flatten.join(' ')
exec(command_line)
-end
+end
def daemonize(pid_file = nil)
return yield if $DEBUG
@@ -83,4 +97,3 @@ if options[:daemon]
else
exec_server.call
end
- |