Class: ActiveRecordProgressFormatter

Inherits:
RSpec::Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/rspec/activerecord/progress_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ ActiveRecordProgressFormatter

Returns a new instance of ActiveRecordProgressFormatter.



11
12
13
14
15
16
17
# File 'lib/rspec/activerecord/progress_formatter.rb', line 11

def initialize(output)
  super

  @colorizer  = ::RSpec::Core::Formatters::ConsoleCodes
  @collector  = ActiveRecordFormatterHelpers::Collector.new
  @report     = ActiveRecordFormatterHelpers::Report.new(collector)
end

Instance Attribute Details

#collectorObject (readonly)

Returns the value of attribute collector.



5
6
7
# File 'lib/rspec/activerecord/progress_formatter.rb', line 5

def collector
  @collector
end

#colorizerObject (readonly)

Returns the value of attribute colorizer.



5
6
7
# File 'lib/rspec/activerecord/progress_formatter.rb', line 5

def colorizer
  @colorizer
end

#reportObject (readonly)

Returns the value of attribute report.



5
6
7
# File 'lib/rspec/activerecord/progress_formatter.rb', line 5

def report
  @report
end

Instance Method Details

#dump_summary(summary) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/rspec/activerecord/progress_formatter.rb', line 37

def dump_summary(summary)
  base = ActiveRecordFormatterBase.new(summary, collector)
  output.puts base.colorized_summary

  output.puts "\nOutputting Detailed Profile Data to #{report.report_path}"
  report.write
end

#example_group_finished(example_group) ⇒ Object



29
30
31
# File 'lib/rspec/activerecord/progress_formatter.rb', line 29

def example_group_finished(example_group)
  collector.group_finished(example_group.group)
end

#example_group_started(example_group) ⇒ Object



24
25
26
27
# File 'lib/rspec/activerecord/progress_formatter.rb', line 24

def example_group_started(example_group)
  collector.group_started(example_group.group)
  super
end

#example_started(example) ⇒ Object



33
34
35
# File 'lib/rspec/activerecord/progress_formatter.rb', line 33

def example_started(example)
  collector.reset_example(example)
end

#start(_start_notification) ⇒ Object



19
20
21
22
# File 'lib/rspec/activerecord/progress_formatter.rb', line 19

def start(_start_notification)
  output.puts "Recording and reporting ActiveRecord select and creation counts."
  super
end