diff --git a/lib/hydra/runner.rb b/lib/hydra/runner.rb index e689a7c..f4ddbb8 100644 --- a/lib/hydra/runner.rb +++ b/lib/hydra/runner.rb @@ -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::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 =~ /^\.*$/ - pipe.write RSpecResult.new(:output => output) - pipe.close - end - pipe.identify_as_parent - output_message = pipe.gets - Process.wait pid + hydra_output = StringIO.new + Spec::Runner.options.instance_variable_set(:@formatters, [ + Spec::Runner::Formatter::HydraFormatter.new( + Spec::Runner.options.formatter_options, + hydra_output + ) + ]) + 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 =~ /^\.*$/ - return output_message.output + return output end # run all the scenarios in a cucumber feature file diff --git a/lib/hydra/spec/hydra_formatter.rb b/lib/hydra/spec/hydra_formatter.rb index 753d643..36bdc2f 100644 --- a/lib/hydra/spec/hydra_formatter.rb +++ b/lib/hydra/spec/hydra_formatter.rb @@ -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 diff --git a/lib/hydra/tasks.rb b/lib/hydra/tasks.rb index e7af1a8..4db699e 100644 --- a/lib/hydra/tasks.rb +++ b/lib/hydra/tasks.rb @@ -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