class DatabaseLeakFinder::Logger

Public Instance Methods

log(example, leaks) click to toggle source
# File lib/database_leak_finder/logger.rb, line 5
    def log(example, leaks)
      puts <<-LOG.strip_heredoc
        \n
        #{HighLine.color('#### Leaking Spec', :red)}
        The spec '#{HighLine.color(spec_path_for(example), :red, :underline)}' leaves the following rows in the database:
      LOG
      leaks.each(&method(:log_leak))
    end

Private Instance Methods

log_leak(table, count) click to toggle source
# File lib/database_leak_finder/logger.rb, line 19
def log_leak(table, count)
  puts "     - #{HighLine.color(count.to_s, :red)} #{'row'.pluralize(count)} for the #{HighLine.color(table, :white, :underline)} table"
end
spec_path_for(example) click to toggle source
# File lib/database_leak_finder/logger.rb, line 15
def spec_path_for(example)
  example.metadata[:example_group][:file_path]
end