Skip to content

Commit

Permalink
(PUP-3912) Update parallel:spec task for rspec 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Kylo Ginsberg committed Jan 26, 2015
1 parent 90be038 commit c883e0a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 3 additions & 6 deletions tasks/parallel.rake
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ else
# Responsible for parallelizing spec testing.
#
class Parallelizer
include ::RSpec::Core::Formatters::Helpers

# Number of processes to use
attr_reader :process_count
# Approximate size of each group of tests
Expand Down Expand Up @@ -341,7 +339,7 @@ else
end

# Print out the run time
puts "\nFinished in #{format_duration(Time.now - @start_time)}"
puts "\nFinished in #{::RSpec::Core::Formatters::Helpers.format_duration(Time.now - @start_time)}"

# Count all of the examples
examples = 0
Expand Down Expand Up @@ -373,8 +371,8 @@ else
end

def summary_count_line(examples, failures, pending)
summary = pluralize(examples, "example")
summary << ", " << pluralize(failures, "failure")
summary = ::RSpec::Core::Formatters::Helpers.pluralize(examples, "example")
summary << ", " << ::RSpec::Core::Formatters::Helpers.pluralize(failures, "failure")
summary << ", #{pending} pending" if pending > 0
summary
end
Expand All @@ -389,7 +387,6 @@ else
config.error_stream = $stderr
config.output_stream = $stdout
options = ::RSpec::Core::ConfigurationOptions.new []
options.parse_options
options.configure config
config.color
end
Expand Down
1 change: 0 additions & 1 deletion util/rspec_grouper
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module Parallel
def initialize(group_size)
config = ::RSpec::Core::Configuration.new
options = ::RSpec::Core::ConfigurationOptions.new((ENV['TEST'] || ENV['TESTS'] || 'spec').split(';'))
options.parse_options
options.configure config

# This will scan and load all spec examples
Expand Down
8 changes: 5 additions & 3 deletions util/rspec_runner
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rubygems'
require 'rspec'
require 'rspec/core/formatters/progress_formatter'
require 'rspec/core/command_line'
require 'rspec/core/runner'

# Disable ruby verbosity
# We need control over output so that the parallel task can parse it correctly
Expand All @@ -15,6 +15,7 @@ module Parallel
# This differs from the built-in progress formatter by not appending an index to failures.
#
class Formatter < ::RSpec::Core::Formatters::ProgressFormatter
::RSpec::Core::Formatters.register self, :dump_failure
def dump_failure(example, _)
# Unlike the super class implementation, do not print the failure number
output.puts "#{short_padding}#{example.full_description}"
Expand All @@ -34,7 +35,8 @@ module Parallel
end

def run
::RSpec::Core::CommandLine.new(@options).run($stderr, $stdout)
@options = ::RSpec::Core::ConfigurationOptions.new(@options)
::RSpec::Core::Runner.new(@options).run($stderr, $stdout)
end
end
end
Expand All @@ -50,4 +52,4 @@ if __FILE__ == $0
else
exit Parallel::RSpec::Runner.new(ARGV[0]).run
end
end
end

0 comments on commit c883e0a

Please sign in to comment.