fast rspec running
This commit is contained in:
parent
38044943c3
commit
c36ec7a0a0
|
@ -110,33 +110,28 @@ module Hydra #:nodoc:
|
|||
rescue LoadError => ex
|
||||
return ex.to_s
|
||||
end
|
||||
# we have to run the rspec test in a sub-process
|
||||
# this is because rspec runs all the tests that
|
||||
# have been required, so if we kept requiring the
|
||||
# files they'd get run over and over
|
||||
pipe = Hydra::Pipe.new
|
||||
pid = SafeFork.fork do
|
||||
pipe.identify_as_child
|
||||
hydra_output = StringIO.new
|
||||
Spec::Runner.options.formatters = [
|
||||
Spec::Runner.options.instance_variable_set(:@formatters, [
|
||||
Spec::Runner::Formatter::HydraFormatter.new(
|
||||
Spec::Runner.options.formatter_options,
|
||||
hydra_output
|
||||
)
|
||||
]
|
||||
Spec::Runner.options.files = [file]
|
||||
])
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@example_groups, []
|
||||
)
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@files, [file]
|
||||
)
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@files_loaded, false
|
||||
)
|
||||
Spec::Runner.options.run_examples
|
||||
hydra_output.rewind
|
||||
output = hydra_output.read.chomp
|
||||
output = "" if output =~ /^\.*$/
|
||||
pipe.write RSpecResult.new(:output => output)
|
||||
pipe.close
|
||||
end
|
||||
pipe.identify_as_parent
|
||||
output_message = pipe.gets
|
||||
Process.wait pid
|
||||
|
||||
return output_message.output
|
||||
return output
|
||||
end
|
||||
|
||||
# run all the scenarios in a cucumber feature file
|
||||
|
|
|
@ -3,16 +3,14 @@ require 'spec/runner/formatter/progress_bar_formatter'
|
|||
module Spec
|
||||
module Runner
|
||||
class << self
|
||||
# stop the auto-run at_exit
|
||||
def run
|
||||
return 0
|
||||
end
|
||||
end
|
||||
class Options
|
||||
attr_accessor :formatters
|
||||
attr_accessor :files
|
||||
end
|
||||
module Formatter
|
||||
class HydraFormatter < ProgressBarFormatter
|
||||
# Stifle the post-test summary
|
||||
def dump_summary(duration, example, failure, pending)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -98,7 +98,7 @@ module Hydra #:nodoc:
|
|||
desc "Hydra Tests" + (@name == :hydra ? "" : " for #{@name}")
|
||||
task @name do
|
||||
Hydra::Master.new(@opts)
|
||||
exit(0) #bypass test on_exit output
|
||||
#exit(0) #bypass test on_exit output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue