Class: ActiveRecordDocumentationFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ ActiveRecordDocumentationFormatter

Returns a new instance of ActiveRecordDocumentationFormatter.



8
9
10
11
12
13
14
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 8

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.



2
3
4
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 2

def collector
  @collector
end

#colorizerObject (readonly)

Returns the value of attribute colorizer.



2
3
4
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 2

def colorizer
  @colorizer
end

#reportObject (readonly)

Returns the value of attribute report.



2
3
4
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 2

def report
  @report
end

Instance Method Details

#dump_summary(summary) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 35

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



26
27
28
29
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 26

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

#example_group_started(example_group) ⇒ Object



21
22
23
24
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 21

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

#example_started(example) ⇒ Object



31
32
33
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 31

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

#start(_start_notification) ⇒ Object



16
17
18
19
# File 'lib/rspec/activerecord/documentation_formatter.rb', line 16

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