From 7f197c371904f99116fa570e0d4cb3b469766768 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 3 Sep 2011 07:54:52 -0400 Subject: [PATCH] modify reporter for use with guard --- lib/jasmine/headless/report.rb | 13 +++++-------- lib/jasmine/headless/report_message/total.rb | 1 + lib/jasmine/headless/version.rb | 2 +- spec/lib/jasmine/headless/report_spec.rb | 3 +++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/jasmine/headless/report.rb b/lib/jasmine/headless/report.rb index b4abfdf..4b7f130 100644 --- a/lib/jasmine/headless/report.rb +++ b/lib/jasmine/headless/report.rb @@ -5,6 +5,7 @@ module Jasmine::Headless extend Forwardable def_delegators :report, :length, :[] + def_delegators :last_total, :total, :failed, :time class << self def load(file) @@ -29,14 +30,6 @@ module Jasmine::Headless self end - def total - last_total.total - end - - def failed - last_total.failed - end - def has_used_console? @report.any? { |entry| entry.class == Jasmine::Headless::ReportMessage::Console } end @@ -49,6 +42,10 @@ module Jasmine::Headless } end + def valid? + last_total != nil + end + private def last_total diff --git a/lib/jasmine/headless/report_message/total.rb b/lib/jasmine/headless/report_message/total.rb index dc1cc12..c66009d 100644 --- a/lib/jasmine/headless/report_message/total.rb +++ b/lib/jasmine/headless/report_message/total.rb @@ -20,6 +20,7 @@ module Jasmine::Headless::ReportMessage end def ==(other) + other && self.total == other.total && self.failed == other.failed && self.time == other.time && diff --git a/lib/jasmine/headless/version.rb b/lib/jasmine/headless/version.rb index 8fd51dc..fd6480e 100644 --- a/lib/jasmine/headless/version.rb +++ b/lib/jasmine/headless/version.rb @@ -1,5 +1,5 @@ module Jasmine module Headless - VERSION = "0.6.4" + VERSION = "0.7.0" end end diff --git a/spec/lib/jasmine/headless/report_spec.rb b/spec/lib/jasmine/headless/report_spec.rb index e5f6d62..6588060 100644 --- a/spec/lib/jasmine/headless/report_spec.rb +++ b/spec/lib/jasmine/headless/report_spec.rb @@ -37,6 +37,9 @@ REPORT report.total.should == 1 report.failed.should == 2 report.should have_used_console + report.time.should == 3.0 + + report.should be_valid report.should have_failed_on("Statement Two") end