runs rspec, but slowly because spec_helper keeps getting reloaded
This commit is contained in:
parent
b831522a47
commit
38044943c3
@ -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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Nick Gauthier"]
|
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.description = %q{Spread your tests over multiple machines to test your code faster.}
|
||||||
s.email = %q{nick@smartlogicsolutions.com}
|
s.email = %q{nick@smartlogicsolutions.com}
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
|
@ -103,7 +103,6 @@ module Hydra #:nodoc:
|
|||||||
|
|
||||||
# run all the Specs in an RSpec file (NOT IMPLEMENTED)
|
# run all the Specs in an RSpec file (NOT IMPLEMENTED)
|
||||||
def run_rspec_file(file)
|
def run_rspec_file(file)
|
||||||
puts "RUNNING: #{file}"
|
|
||||||
# pull in rspec
|
# pull in rspec
|
||||||
begin
|
begin
|
||||||
require 'spec'
|
require 'spec'
|
||||||
@ -118,12 +117,15 @@ module Hydra #:nodoc:
|
|||||||
pipe = Hydra::Pipe.new
|
pipe = Hydra::Pipe.new
|
||||||
pid = SafeFork.fork do
|
pid = SafeFork.fork do
|
||||||
pipe.identify_as_child
|
pipe.identify_as_child
|
||||||
options = Spec::Runner.options
|
|
||||||
hydra_output = StringIO.new
|
hydra_output = StringIO.new
|
||||||
options.formatters = [Spec::Runner::Formatter::HydraFormatter.new(options.formatter_options, hydra_output)]
|
Spec::Runner.options.formatters = [
|
||||||
require file
|
Spec::Runner::Formatter::HydraFormatter.new(
|
||||||
options.files = [file]
|
Spec::Runner.options.formatter_options,
|
||||||
options.run_examples
|
hydra_output
|
||||||
|
)
|
||||||
|
]
|
||||||
|
Spec::Runner.options.files = [file]
|
||||||
|
Spec::Runner.options.run_examples
|
||||||
hydra_output.rewind
|
hydra_output.rewind
|
||||||
output = hydra_output.read.chomp
|
output = hydra_output.read.chomp
|
||||||
output = "" if output =~ /^\.*$/
|
output = "" if output =~ /^\.*$/
|
||||||
@ -133,6 +135,7 @@ module Hydra #:nodoc:
|
|||||||
pipe.identify_as_parent
|
pipe.identify_as_parent
|
||||||
output_message = pipe.gets
|
output_message = pipe.gets
|
||||||
Process.wait pid
|
Process.wait pid
|
||||||
|
|
||||||
return output_message.output
|
return output_message.output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,6 +2,11 @@ require 'spec/autorun'
|
|||||||
require 'spec/runner/formatter/progress_bar_formatter'
|
require 'spec/runner/formatter/progress_bar_formatter'
|
||||||
module Spec
|
module Spec
|
||||||
module Runner
|
module Runner
|
||||||
|
class << self
|
||||||
|
def run
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
class Options
|
class Options
|
||||||
attr_accessor :formatters
|
attr_accessor :formatters
|
||||||
attr_accessor :files
|
attr_accessor :files
|
||||||
|
@ -72,6 +72,9 @@ module Hydra #:nodoc:
|
|||||||
|
|
||||||
yield self if block_given?
|
yield self if block_given?
|
||||||
|
|
||||||
|
# Ensure we override rspec's at_exit
|
||||||
|
require 'hydra/spec/hydra_formatter'
|
||||||
|
|
||||||
@config = find_config_file
|
@config = find_config_file
|
||||||
|
|
||||||
@opts = {
|
@opts = {
|
||||||
@ -95,7 +98,6 @@ module Hydra #:nodoc:
|
|||||||
desc "Hydra Tests" + (@name == :hydra ? "" : " for #{@name}")
|
desc "Hydra Tests" + (@name == :hydra ? "" : " for #{@name}")
|
||||||
task @name do
|
task @name do
|
||||||
Hydra::Master.new(@opts)
|
Hydra::Master.new(@opts)
|
||||||
puts "OK AND QUIT"
|
|
||||||
exit(0) #bypass test on_exit output
|
exit(0) #bypass test on_exit output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user