class ActiveRecordDocumentationFormatter

Attributes

collector[R]
colorizer[R]
report[R]

Public Class Methods

new(output) click to toggle source
Calls superclass method
# 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

Public Instance Methods

dump_summary(summary) click to toggle source
# 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) click to toggle source
Calls superclass method
# 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) click to toggle source
Calls superclass method
# 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) click to toggle source
# File lib/rspec/activerecord/documentation_formatter.rb, line 31
def example_started(example)
  collector.reset_example(example)
end
start(_start_notification) click to toggle source
Calls superclass method
# 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

Protected Instance Methods

example_counts(suffix: " ") click to toggle source
# File lib/rspec/activerecord/documentation_formatter.rb, line 55
def example_counts(suffix: " ")
  "(%02d, %02d)#{suffix}" % [collector.objects_count, collector.query_count]
end
failure_output(example) click to toggle source
# File lib/rspec/activerecord/documentation_formatter.rb, line 50
def failure_output(example)
  "#{current_indentation}#{example_counts}" +
    colorizer.wrap("#{example.description.strip} (FAILED - #{next_failure_index})", :failure)
end
passed_output(example) click to toggle source
# File lib/rspec/activerecord/documentation_formatter.rb, line 45
def passed_output(example)
  "#{current_indentation}#{example_counts}" +
    colorizer.wrap(example.description.strip, :success)
end