diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2007-05-31 14:16:25 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2007-05-31 14:16:25 +0200 |
commit | 55ac89c3f25e7a24fa5306e400af76483d2144ce (patch) | |
tree | 3d284a555a41bf8dc8f159c86ceb9ba976ba0958 /lib/bacon.rb | |
parent | 60f8cc954044f0f5031dc0d62ecd4afc6fa96ac5 (diff) | |
download | bacon-55ac89c3f25e7a24fa5306e400af76483d2144ce.tar.gz bacon-55ac89c3f25e7a24fa5306e400af76483d2144ce.tar.xz bacon-55ac89c3f25e7a24fa5306e400af76483d2144ce.zip |
Fix output
darcs-hash:20070531121625-4fc50-c1513a3fcc7139e3cdc1c5b44cf3b877064c882d.gz
Diffstat (limited to 'lib/bacon.rb')
-rw-r--r-- | lib/bacon.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index bda684d..ccf7427 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -7,7 +7,7 @@ module Bacon def self.result_string "%d specifications (%d requirements), %d failures, %d errors" % [Counter[:specifications], Counter[:requirements], - Counter[:failed], Counter[:error]] + Counter[:failed], Counter[:errors]] end def self.handle_specification(name) @@ -19,7 +19,11 @@ module Bacon def self.handle_requirement(description) print "- #{description}" error = yield - puts " [#{error}]" + if error.empty? + puts + else + puts " [#{error}]" + end end class Error < RuntimeError @@ -46,7 +50,7 @@ module Bacon def after(&block); @after << block; end def it(description, &block) - Bacon::Counter[:requirements] += 1 + Bacon::Counter[:specifications] += 1 run_requirement description, block end @@ -111,7 +115,6 @@ class Object end def describe(name, &block) - Bacon::Counter[:specifications] += 1 Bacon::Context.new(name, &block) end end @@ -150,8 +153,8 @@ class Should unless @negated ^ yield(@object, *args) raise Bacon::Error.new(:failed, "") end - Bacon::Counter[:passed] += 1 - @object + Bacon::Counter[:requirements] += 1 + @negated ^ r ? r : false end def method_missing(name, *args, &block) |