Class: Test::Reporters::Outline
  
  
  
  Constant Summary
  
  Constants inherited
     from Abstract
  Abstract::TITLES
  Instance Attribute Summary
  
  Attributes inherited from Abstract
  #runner
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from Abstract
  #clean_backtrace, #code, #end_test, #file, #file_and_line, #file_and_line_array, inherited, #initialize, #line, #record, registry, #skip_case, #skip_test, #subtotal, #tally, #tally_item, #timestamp, #total, #total_count
  
    Instance Method Details
    
      
  
  
    #begin_case(tc)  ⇒ Object 
  
  
  
  
    | 
18
19
20
21
22
23
24
25
26
27
28
29 | # File 'lib/test/reporters/outline.rb', line 18
def begin_case(tc)
  lines = tc.to_s.split("\n")
  label = lines.shift
  if tc.respond_to?(:type)
    tabs "#{tc.type}: #{label}".ansi(:bold)
    tabs lines.join("\n"), 2 unless lines.empty?
  else
    tabs "#{label}".ansi(:bold)
    tabs lines.join("\n"), 2 unless lines.empty?
  end
  @tab += 2
end | 
 
    
      
  
  
    #begin_suite(suite)  ⇒ Object 
  
  
  
  
    | 
9
10
11
12
13
14
15 | # File 'lib/test/reporters/outline.rb', line 9
def begin_suite(suite)
  @tab   = 0
  @start_time = Time.now
  @start_test_cache = {}
  timer_reset
end | 
 
    
      
  
  
    #begin_test(test)  ⇒ Object 
  
  
  
  
    | 
32
33
34
35
36
37
38
39
40
41 | # File 'lib/test/reporters/outline.rb', line 32
def begin_test(test)
   if test.respond_to?(:topic) && test.topic
     topic = test.topic.to_s
     @start_test_cache[topic] ||= (
       tabs "#{topic}"
       true
     )
   end
   timer_reset
end | 
 
    
      
  
  
    #clock  ⇒ Object 
  
  
  
  
    | 
145
146
147
148 | # File 'lib/test/reporters/outline.rb', line 145
def clock
  secs = Time.now - @start_time
  return "%0.5fs" % [secs.to_s]
end | 
 
    
      
  
  
    #end_case(tcase)  ⇒ Object 
  
  
  
  
    | 
86
87
88 | # File 'lib/test/reporters/outline.rb', line 86
def end_case(tcase)
  @tab -= 2
end | 
 
    
      
  
  
    #end_suite(suite)  ⇒ Object 
  
  
  
  
    | 
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 | # File 'lib/test/reporters/outline.rb', line 91
def end_suite(suite)
  puts
          
                
                          
                            
  puts
  puts timestamp
  puts
  puts tally
end | 
 
    
      
  
  
    #error(test, exception)  ⇒ Object 
  
  
  
  
    | 
62
63
64
65
66
67
68
69
70
71
72 | # File 'lib/test/reporters/outline.rb', line 62
def error(test, exception)
  tabs "#{test}".ansi(:red, :bold)
  s = []
  s << "#{exception.class}"
  s << "#{exception}"
  s << "#{file_and_line(exception)}"
  s << code(exception)
    tabs s.join("\n"), 4
end | 
 
    
      
  
  
    #fail(test, exception)  ⇒ Object 
  
  
  
  
    | 
50
51
52
53
54
55
56
57
58
59 | # File 'lib/test/reporters/outline.rb', line 50
def fail(test, exception)
  tabs "#{test}".ansi(:red)
  s = []
  s << "#{exception}"
  s << "#{file_and_line(exception)}"
  s << code(exception)
    tabs s.join("\n"), 4
end | 
 
    
      
  
  
    #omit(test, exception)  ⇒ Object 
  
  
  
  
    | 
81
82
83 | # File 'lib/test/reporters/outline.rb', line 81
def omit(test, exception)
  tabs "#{test}".ansi(:cyan)
end | 
 
    
      
  
  
    #pass(test)  ⇒ Object 
  
  
  
  
    | 
45
46
47 | # File 'lib/test/reporters/outline.rb', line 45
def pass(test)
  tabs "#{test}".ansi(:green)
end | 
 
    
      
  
  
    #tabs(str, indent = 0)  ⇒ Object 
  
  
  
  
    | 
163
164
165
166
167
168
169 | # File 'lib/test/reporters/outline.rb', line 163
def tabs(str, indent=0)
  if str
    puts(str.tabto(@tab + indent))
  else
    puts
  end
end | 
 
    
      
  
  
    #timer  ⇒ Object 
  
  
  
  
    | 
151
152
153
154
155 | # File 'lib/test/reporters/outline.rb', line 151
def timer
  secs  = Time.now - @time
  @time = Time.now
  return "%0.5fs" % [secs.to_s]
end | 
 
    
      
  
  
    #timer_reset  ⇒ Object 
  
  
  
  
    | 
158
159
160 | # File 'lib/test/reporters/outline.rb', line 158
def timer_reset
  @time = Time.now
end | 
 
    
      
  
  
    #todo(test, exception)  ⇒ Object 
  
  
  
  
    | 
75
76
77
78 | # File 'lib/test/reporters/outline.rb', line 75
def todo(test, exception)
  tabs "#{test}".ansi(:yellow)
  tabs "#{file_and_line(exception)}", 4
end |