Sha256: 51c333ec6f8a83d475ab7cfcc36feb9032f8127ef622d27fdb5db19f430c5ea7

Contents?: true

Size: 1.16 KB

Versions: 32

Compression:

Stored size: 1.16 KB

Contents

require 'parallelized_specs'
require File.join(File.dirname(__FILE__), 'spec_logger_base')

class ParallelizedSpecs::SpecStartFinishLogger < ParallelizedSpecs::SpecLoggerBase
  def initialize(options, output=nil)
    output ||= options # rspec 2 has output as first argument

    output = "#{output}_#{ENV['TEST_ENV_NUMBER']}.log"
    if String === output
      FileUtils.mkdir_p(File.dirname(output))
      File.open(output, 'w') {} # overwrite previous results
      @output = File.open(output, 'a')
    elsif File === output
      output.close # close file opened with 'w'
      @output = File.open(output.path, 'a')
    else
      @output = output
    end
  end

  def example_started(example)
    lock_output do
      @output.puts "\nstarted spec: #{example.description}"
    end
  end

  def example_passed(example)
    lock_output do
      @output.puts "finished spec: #{example.description}"
    end
  end

  def example_pending(example, message)
    lock_output do
      @output.puts "finished spec: #{example.description}"
    end
  end

  def example_failed(example, count, failure)
    lock_output do
      @output.puts "finished spec: #{example.description}"
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
parallelized_specs-0.4.84 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.83 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.82 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.81 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.80 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.79 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.78 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.77 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.76 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.75 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.74 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.73 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.72 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.71 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.70 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.69 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.68 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.67 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.66 lib/parallelized_specs/spec_start_finish_logger.rb
parallelized_specs-0.4.65 lib/parallelized_specs/spec_start_finish_logger.rb