Class: RspecLogFormatter::Formatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec_log_formatter/formatter.rb

Defined Under Namespace

Classes: Factory

Instance Method Summary collapse

Constructor Details

#initialize(output, opts = {}) ⇒ Formatter

Returns a new instance of Formatter.



23
24
25
26
27
28
29
# File 'lib/rspec_log_formatter/formatter.rb', line 23

def initialize(output, opts={})
  super(output)
  @clock = opts[:clock]
  @build_number = opts[:build_number]
  @limit_history = opts[:limit_history]
  @history_manager = RspecLogFormatter::HistoryManager.new(FILENAME)
end

Instance Method Details

#dump_summary(_, _, _, _) ⇒ Object



43
44
45
46
# File 'lib/rspec_log_formatter/formatter.rb', line 43

def dump_summary(_,_,_,_)
  return unless @limit_history
  @history_manager.truncate(@limit_history)
end

#example_failed(example) ⇒ Object



39
40
41
# File 'lib/rspec_log_formatter/formatter.rb', line 39

def example_failed(example)
  record("failed", example, clock.now, clock.now - @clock_start, example.exception)
end

#example_passed(example) ⇒ Object



35
36
37
# File 'lib/rspec_log_formatter/formatter.rb', line 35

def example_passed(example)
  record("passed", example, clock.now, clock.now - @clock_start)
end

#example_started(example) ⇒ Object



31
32
33
# File 'lib/rspec_log_formatter/formatter.rb', line 31

def example_started(example)
  @clock_start = clock.now
end