Sha256: a7f58c8cfe4e8d5053f0dd8b7f9488ff2fc052302117e9cabbd7a93c7bac3fe2
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
require 'highline' module DatabasePlumber class Report def self.on(example, leaks) puts <<-REPORT.strip_heredoc #{HighLine.color('#### Leaking Test', :red)} The spec '#{HighLine.color(spec_path_for(example), :red, :underline)}' leaves the following rows in the database: REPORT leaks.each(&method(:print_leak)) puts <<-REPORT.strip_heredoc #{HighLine.color('#### What now?', :yellow)} If you are using #{HighLine.color('let!', :yellow)} or #{HighLine.color('before(:all)', :yellow)} please ensure that you use a corresponding #{HighLine.color('after(:all)', :yellow)} block to clean up these rows. REPORT end private_class_method def self.print_leak(model, count) puts " - #{HighLine.color(count.to_s, :blue)} row(s) for the #{model} model \n" end private_class_method def self.spec_path_for(example) example.metadata[:example_group][:file_path] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
database_plumber-1.1.0 | lib/database_plumber/report.rb |
database_plumber-1.0.0 | lib/database_plumber/report.rb |