more modern rspec fixes
This commit is contained in:
parent
61eecdf2b8
commit
c8ade6557e
|
@ -15,7 +15,7 @@ module Hydra #:nodoc:
|
||||||
# Boot up a runner. It takes an IO object (generally a pipe from its
|
# Boot up a runner. It takes an IO object (generally a pipe from its
|
||||||
# parent) to send it messages on which files to execute.
|
# parent) to send it messages on which files to execute.
|
||||||
def initialize(opts = {})
|
def initialize(opts = {})
|
||||||
redirect_output( opts.fetch( :runner_log_file ) { DEFAULT_LOG_FILE } )
|
#redirect_output( opts.fetch( :runner_log_file ) { DEFAULT_LOG_FILE } )
|
||||||
reg_trap_sighup
|
reg_trap_sighup
|
||||||
|
|
||||||
@io = opts.fetch(:io) { raise "No IO Object" }
|
@io = opts.fetch(:io) { raise "No IO Object" }
|
||||||
|
@ -148,7 +148,6 @@ module Hydra #:nodoc:
|
||||||
# pull in rspec
|
# pull in rspec
|
||||||
begin
|
begin
|
||||||
require 'rspec'
|
require 'rspec'
|
||||||
require 'hydra/spec/hydra_formatter'
|
|
||||||
# Ensure we override rspec's at_exit
|
# Ensure we override rspec's at_exit
|
||||||
RSpec::Core::Runner.disable_autorun!
|
RSpec::Core::Runner.disable_autorun!
|
||||||
rescue LoadError => ex
|
rescue LoadError => ex
|
||||||
|
@ -156,19 +155,14 @@ module Hydra #:nodoc:
|
||||||
end
|
end
|
||||||
hydra_output = StringIO.new
|
hydra_output = StringIO.new
|
||||||
|
|
||||||
config = [
|
config = [ '-f', 'progress', file ]
|
||||||
'-f', 'RSpec::Core::Formatters::HydraFormatter',
|
|
||||||
file
|
|
||||||
]
|
|
||||||
|
|
||||||
RSpec.instance_variable_set(:@world, nil)
|
RSpec.instance_variable_set(:@world, nil)
|
||||||
RSpec::Core::Runner.run(config, hydra_output, hydra_output)
|
RSpec.instance_variable_set(:@configuration, nil)
|
||||||
|
result = RSpec::Core::Runner.run(config, hydra_output, hydra_output)
|
||||||
hydra_output.rewind
|
hydra_output.rewind
|
||||||
output = hydra_output.read.chomp
|
|
||||||
output = "" if output.gsub("\n","") =~ /^[\.\*]*$/
|
|
||||||
|
|
||||||
return output
|
return (result == 1) ? hydra_output.read : ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# run all the scenarios in a cucumber feature file
|
# run all the scenarios in a cucumber feature file
|
||||||
|
|
|
@ -3,6 +3,13 @@ module RSpec
|
||||||
module Core
|
module Core
|
||||||
module Formatters
|
module Formatters
|
||||||
class HydraFormatter < ProgressFormatter
|
class HydraFormatter < ProgressFormatter
|
||||||
|
def example_passed(example)
|
||||||
|
output.print "."
|
||||||
|
end
|
||||||
|
|
||||||
|
def example_failed(example)
|
||||||
|
output.print "F"
|
||||||
|
end
|
||||||
# Stifle the post-test summary
|
# Stifle the post-test summary
|
||||||
def dump_summary(duration, example, failure, pending)
|
def dump_summary(duration, example, failure, pending)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue