class Rectify::RSpec::DatabaseReporter::Reporter

Attributes

current_example[R]
query_stats[R]

Public Class Methods

new() click to toggle source
# File lib/rectify/rspec/database_reporter/reporter.rb, line 34
def initialize
  @query_stats = QueryStats.new
end

Public Instance Methods

example_started(notification) click to toggle source
# File lib/rectify/rspec/database_reporter/reporter.rb, line 45
def example_started(notification)
  @current_example = notification.example
end
start(_) click to toggle source
# File lib/rectify/rspec/database_reporter/reporter.rb, line 38
def start(_)
  ActiveSupport::Notifications
    .subscribe("sql.active_record") do |_, start, finish, _, query|
      query_stats.add(current_example, start, finish, query)
    end
end
start_dump(_) click to toggle source
# File lib/rectify/rspec/database_reporter/reporter.rb, line 49
def start_dump(_)
  Display.new(query_stats).render
end