Class: ParallelSpecs::SpecErrorLogger

Inherits:
SpecLoggerBase show all
Defined in:
lib/parallel_specs/spec_error_logger.rb

Constant Summary

Constants inherited from SpecLoggerBase

ParallelSpecs::SpecLoggerBase::RSPEC_1

Instance Method Summary collapse

Methods inherited from SpecLoggerBase

#close, #dump_failure, #dump_failures, #dump_pending, #lock_output

Constructor Details

#initialize(options, output = nil) ⇒ SpecErrorLogger

Returns a new instance of SpecErrorLogger.



5
6
7
8
9
10
# File 'lib/parallel_specs/spec_error_logger.rb', line 5

def initialize(options, output=nil)
  super
  @passed_examples = []
  @pending_examples = []
  @failed_examples = []
end

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/parallel_specs/spec_error_logger.rb', line 24

def dump_summary(duration, example_count, failure_count, pending_count)
  lock_output do
    env_test_number = ENV['TEST_ENV_NUMBER']
    env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
    @output.puts ""
    @output.puts ""
    @output.puts "FOR TEST EXECUTOR #{env_test_number}: #{@failed_examples.size} failed, #{@passed_examples.size} passed:"
    @failed_examples.each.with_index do | failure, i |
      @output.puts ""
      @output.puts "#{ i + 1 })"
      @output.puts failure.header
      unless failure.exception.nil?
        @output.puts failure.exception.to_s
        failure.exception.backtrace.each do | caller |
          @output.puts caller
        end
      end
    end
  end
  @output.flush
end

#example_failed(example, count, failure) ⇒ Object



20
21
22
# File 'lib/parallel_specs/spec_error_logger.rb', line 20

def example_failed(example, count, failure)
  @failed_examples << failure
end

#example_passed(example) ⇒ Object



12
13
14
# File 'lib/parallel_specs/spec_error_logger.rb', line 12

def example_passed(example)
  @passed_examples << example
end

#example_pending(*args) ⇒ Object



16
17
18
# File 'lib/parallel_specs/spec_error_logger.rb', line 16

def example_pending(*args)
  @pending_examples << args
end