Sha256: f4ad6d96f70effe8995fb9d539b9710587c9950053de80dbd3609b593ad4f758

Contents?: true

Size: 1.69 KB

Versions: 53

Compression:

Stored size: 1.69 KB

Contents

require 'parallelized_specs/spec_logger_base'

module RSpec

  class ParallelizedSpecs::OutcomeBuilder < ParallelizedSpecs::SpecLoggerBase

    def start(example_count)
      @example_count = example_count
      env_test_number = ENV['TEST_ENV_NUMBER']
      env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
      puts "Thread #{env_test_number.to_s} has #{@example_count} specs"
      File.open("#{RAILS_ROOT}/tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt", 'a+') { |f| f.write(@example_count) }
      File.open("#{RAILS_ROOT}/tmp/parallel_log/thread_started/thread_#{env_test_number}.txt", 'a+') { |f| f.write("") }
      super
    end


    def dump_summary(duration, example_count, failure_count, pending_count)
      env_test_number = ENV['TEST_ENV_NUMBER']
      env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
      spec_file = "#{RAILS_ROOT}/tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt"
      failure_file = "#{RAILS_ROOT}/tmp/parallel_log/failed_specs/failed_specs#{env_test_number}.txt"
      expected_example_count = File.open(spec_file, &:readline).to_s
      puts "Expected example count = #{expected_example_count} from rspec example count = #{example_count}"
      File.delete(spec_file) if expected_example_count.to_i - example_count.to_i < 2
      puts "Thread example failure count = #{failure_count}"
      failure_count > 0 ? (File.open(failure_file, 'a+') { |f| f.write(failure_count) }) : (puts "All specs in Thread #{env_test_number} passed")
      puts "Thread #{env_test_number} has completed in #{duration}"
    end

    def dump_failures(*args)
      ;
    end

    def dump_failure(*args)
      ;
    end

    def dump_pending(*args)
      ;
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
parallelized_specs-0.4.42 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.41 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.40 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.39 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.38 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.37 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.36 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.35 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.34 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.33 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.32 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.31 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.30 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.29 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.28 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.27 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.26 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.25 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.24 lib/parallelized_specs/outcome_builder.rb
parallelized_specs-0.4.23 lib/parallelized_specs/outcome_builder.rb