Class: PropertyGenerator::Report
- Inherits:
-
Object
- Object
- PropertyGenerator::Report
- Defined in:
- lib/linter/report.rb
Instance Method Summary collapse
- #add_report(report) ⇒ Object
- #display_report ⇒ Object
- #has_a_file_failed_to_load ⇒ Object
- #has_a_test_failed ⇒ Object
-
#initialize(files_failing_load, ignored_tests) ⇒ Report
constructor
A new instance of Report.
- #make_fail_table ⇒ Object
- #make_failing_to_load_table ⇒ Object
- #make_pass_table ⇒ Object
- #make_skip_table ⇒ Object
- #make_warn_table ⇒ Object
Constructor Details
#initialize(files_failing_load, ignored_tests) ⇒ Report
Returns a new instance of Report.
5 6 7 8 9 |
# File 'lib/linter/report.rb', line 5 def initialize(files_failing_load, ignored_tests) @files_failing_load = files_failing_load @full_report = {} @ignored_tests = ignored_tests end |
Instance Method Details
#add_report(report) ⇒ Object
11 12 13 |
# File 'lib/linter/report.rb', line 11 def add_report(report) @full_report = @full_report.merge(report) end |
#display_report ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/linter/report.rb', line 15 def display_report unless @files_failing_load.empty? puts make_failing_to_load_table puts '*****************' puts "Check for property values that start with an interpolated value \nIf the first character of the value is a bracket yaml will fail to load \nPlace the value in quotes" puts '*****************' end puts make_skip_table puts make_pass_table puts make_warn_table puts make_fail_table end |
#has_a_file_failed_to_load ⇒ Object
38 39 40 |
# File 'lib/linter/report.rb', line 38 def has_a_file_failed_to_load !@files_failing_load.empty? end |
#has_a_test_failed ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/linter/report.rb', line 28 def has_a_test_failed failed = false @full_report.each do |test, status| if status[:status] == 'fail' failed = true end end failed end |
#make_fail_table ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/linter/report.rb', line 76 def make_fail_table rows = [] @full_report.each do |test, status| if status[:status] == 'fail' rows << [test.gsub('_', ' '), status[:error].scan(/.{1,90}/).join("\n")] end end Terminal::Table.new(headings: ['Test', 'Error'], title: 'Failing Tests', rows: rows, style: { width: 200 }) end |
#make_failing_to_load_table ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/linter/report.rb', line 42 def make_failing_to_load_table rows = [] @files_failing_load.each do |failed| rows << [failed] end Terminal::Table.new :headings => ['Files'], :title => 'Files Failing to Load', :rows => rows, :style => { :width => 200 } end |
#make_pass_table ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/linter/report.rb', line 56 def make_pass_table rows = [] @full_report.each do |test, status| if status[:status] == 'pass' rows << [test.gsub('_', ' ')] end end Terminal::Table.new(headings: ['Test'], title: 'Passing Tests', rows: rows, style: { width: 200 }) end |
#make_skip_table ⇒ Object
50 51 52 53 54 |
# File 'lib/linter/report.rb', line 50 def make_skip_table return if @ignored_tests.empty? Terminal::Table.new(headings: ['Test'], title: 'Skipped Tests', rows: @ignored_tests.values, style: { width: 200 }) end |
#make_warn_table ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/linter/report.rb', line 66 def make_warn_table rows = [] @full_report.each do |test, status| if status[:status] == 'warn' rows << [test.gsub('_', ' '), status[:error].scan(/.{1,90}/).join("\n")] end end Terminal::Table.new(headings: ['Test', 'Error'], title: 'Warning Tests', rows: rows, style: { width: 200 }) end |