Class: Corundum::QA::Report
- Inherits:
-
Object
- Object
- Corundum::QA::Report
- Defined in:
- lib/corundum/qa-report.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#passed ⇒ Object
Returns the value of attribute passed.
-
#rejects ⇒ Object
readonly
Returns the value of attribute rejects.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#summary_counts ⇒ Object
Returns the value of attribute summary_counts.
Instance Method Summary collapse
- #<<(reject) ⇒ Object
- #add(*args) ⇒ Object
- #empty? ⇒ Boolean
- #fail(summary) ⇒ Object
-
#initialize(name) ⇒ Report
constructor
A new instance of Report.
- #length ⇒ Object (also: #count)
- #to_s(widths = nil) ⇒ Object
Constructor Details
#initialize(name) ⇒ Report
72 73 74 75 76 77 78 |
# File 'lib/corundum/qa-report.rb', line 72 def initialize(name) @name = name @rejects = [] @passed = true @summary = "" @summary_counts = true end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
79 80 81 |
# File 'lib/corundum/qa-report.rb', line 79 def name @name end |
#passed ⇒ Object
Returns the value of attribute passed.
80 81 82 |
# File 'lib/corundum/qa-report.rb', line 80 def passed @passed end |
#rejects ⇒ Object (readonly)
Returns the value of attribute rejects.
79 80 81 |
# File 'lib/corundum/qa-report.rb', line 79 def rejects @rejects end |
#summary ⇒ Object
Returns the value of attribute summary.
80 81 82 |
# File 'lib/corundum/qa-report.rb', line 80 def summary @summary end |
#summary_counts ⇒ Object
Returns the value of attribute summary_counts.
80 81 82 |
# File 'lib/corundum/qa-report.rb', line 80 def summary_counts @summary_counts end |
Instance Method Details
#<<(reject) ⇒ Object
82 83 84 |
# File 'lib/corundum/qa-report.rb', line 82 def <<(reject) @rejects << reject end |
#add(*args) ⇒ Object
86 87 88 |
# File 'lib/corundum/qa-report.rb', line 86 def add(*args) self << Rejection.new(*args) end |
#empty? ⇒ Boolean
100 101 102 |
# File 'lib/corundum/qa-report.rb', line 100 def empty? @rejects.empty? end |
#fail(summary) ⇒ Object
90 91 92 93 |
# File 'lib/corundum/qa-report.rb', line 90 def fail(summary) @passed = false @summary = summary end |
#length ⇒ Object Also known as: count
95 96 97 |
# File 'lib/corundum/qa-report.rb', line 95 def length @rejects.length end |
#to_s(widths = nil) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/corundum/qa-report.rb', line 104 def to_s(widths=nil) Paint[ (passed ? "Ok" : "FAIL") + ": #{name} " + (summary_counts ? "(#{length})" : ""), passed ? :green : :red ] + "\n" + (summary.empty? ? "" : (summary + "\n")) + rejects.map do |reject| " " + reject.to_s(widths) + "\n" end.join("") end |