Class: Jasmine::Headless::Report
- Inherits:
-
Object
- Object
- Jasmine::Headless::Report
- Extended by:
- Forwardable
- Defined in:
- lib/jasmine/headless/report.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Class Method Summary collapse
Instance Method Summary collapse
- #failed_files ⇒ Object
- #has_failed_on?(statement) ⇒ Boolean
- #has_used_console? ⇒ Boolean
-
#initialize(file) ⇒ Report
constructor
A new instance of Report.
- #process ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(file) ⇒ Report
Returns a new instance of Report.
18 19 20 |
# File 'lib/jasmine/headless/report.rb', line 18 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
16 17 18 |
# File 'lib/jasmine/headless/report.rb', line 16 def file @file end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
16 17 18 |
# File 'lib/jasmine/headless/report.rb', line 16 def report @report end |
Class Method Details
.load(file) ⇒ Object
11 12 13 |
# File 'lib/jasmine/headless/report.rb', line 11 def load(file) new(file).process end |
Instance Method Details
#failed_files ⇒ Object
57 58 59 60 61 |
# File 'lib/jasmine/headless/report.rb', line 57 def failed_files @report.find_all { |entry| entry.kind_of?(Jasmine::Headless::ReportMessage::Fail) }.collect(&:filename).uniq.compact end |
#has_failed_on?(statement) ⇒ Boolean
45 46 47 48 49 50 51 |
# File 'lib/jasmine/headless/report.rb', line 45 def has_failed_on?(statement) @report.any? { |entry| if entry.kind_of?(Jasmine::Headless::ReportMessage::Fail) entry.statement == statement end } end |
#has_used_console? ⇒ Boolean
41 42 43 |
# File 'lib/jasmine/headless/report.rb', line 41 def has_used_console? @report.any? { |entry| entry.kind_of?(Jasmine::Headless::ReportMessage::Console) } end |
#process ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jasmine/headless/report.rb', line 22 def process = nil @report = File.readlines(file).collect do |line| type, *parts = line.split('||', -1) if !(report_klass = report_class_for(type)) if .kind_of?(Jasmine::Headless::ReportMessage::Console) . << "\n" . << line.strip end else parts.last.strip! = report_klass.new_from_parts(parts) end end self end |
#valid? ⇒ Boolean
53 54 55 |
# File 'lib/jasmine/headless/report.rb', line 53 def valid? last_total != nil end |