summary refs log tree commit diff
path: root/lib/bacon.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bacon.rb')
-rw-r--r--lib/bacon.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb
index 371e9ab..c3c4f4f 100644
--- a/lib/bacon.rb
+++ b/lib/bacon.rb
@@ -38,13 +38,13 @@ module Bacon
 
   module SpecDoxOutput
     def handle_specification(name)
-      puts name
+      puts spaces + name
       yield
-      puts
+      puts if Counter[:context_depth] == 1
     end
 
     def handle_requirement(description)
-      print "- #{description}"
+      print "#{spaces}  - #{description}"
       error = yield
       puts error.empty? ? "" : " [#{error}]"
     end
@@ -54,6 +54,10 @@ module Bacon
       puts "%d specifications (%d requirements), %d failures, %d errors" %
         Counter.values_at(:specifications, :requirements, :failed, :errors)
     end
+
+    def spaces
+      "  " * (Counter[:context_depth] - 1)
+    end
   end
 
   module TestUnitOutput
@@ -137,7 +141,9 @@ module Bacon
     
     def run
       return  unless name =~ RestrictContext
+      Counter[:context_depth] += 1
       Bacon.handle_specification(name) { instance_eval(&block) }
+      Counter[:context_depth] -= 1
       self
     end