runs rspec, but slowly because spec_helper keeps getting reloaded

This commit is contained in:
Nick Gauthier 2010-04-04 14:07:27 -04:00
parent b831522a47
commit 38044943c3
4 changed files with 18 additions and 8 deletions

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nick Gauthier"]
s.date = %q{2010-04-03}
s.date = %q{2010-04-04}
s.description = %q{Spread your tests over multiple machines to test your code faster.}
s.email = %q{nick@smartlogicsolutions.com}
s.extra_rdoc_files = [

View File

@ -103,7 +103,6 @@ module Hydra #:nodoc:
# run all the Specs in an RSpec file (NOT IMPLEMENTED)
def run_rspec_file(file)
puts "RUNNING: #{file}"
# pull in rspec
begin
require 'spec'
@ -118,12 +117,15 @@ module Hydra #:nodoc:
pipe = Hydra::Pipe.new
pid = SafeFork.fork do
pipe.identify_as_child
options = Spec::Runner.options
hydra_output = StringIO.new
options.formatters = [Spec::Runner::Formatter::HydraFormatter.new(options.formatter_options, hydra_output)]
require file
options.files = [file]
options.run_examples
Spec::Runner.options.formatters = [
Spec::Runner::Formatter::HydraFormatter.new(
Spec::Runner.options.formatter_options,
hydra_output
)
]
Spec::Runner.options.files = [file]
Spec::Runner.options.run_examples
hydra_output.rewind
output = hydra_output.read.chomp
output = "" if output =~ /^\.*$/
@ -133,6 +135,7 @@ module Hydra #:nodoc:
pipe.identify_as_parent
output_message = pipe.gets
Process.wait pid
return output_message.output
end

View File

@ -2,6 +2,11 @@ require 'spec/autorun'
require 'spec/runner/formatter/progress_bar_formatter'
module Spec
module Runner
class << self
def run
return 0
end
end
class Options
attr_accessor :formatters
attr_accessor :files

View File

@ -72,6 +72,9 @@ module Hydra #:nodoc:
yield self if block_given?
# Ensure we override rspec's at_exit
require 'hydra/spec/hydra_formatter'
@config = find_config_file
@opts = {
@ -95,7 +98,6 @@ module Hydra #:nodoc:
desc "Hydra Tests" + (@name == :hydra ? "" : " for #{@name}")
task @name do
Hydra::Master.new(@opts)
puts "OK AND QUIT"
exit(0) #bypass test on_exit output
end
end