Class: Turn::ToptenDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/turn/decorators/topten_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(reporter) ⇒ ToptenDecorator

Returns a new instance of ToptenDecorator.



5
6
7
# File 'lib/turn/decorators/topten_decorator.rb', line 5

def initialize(reporter)
  @reporter = reporter
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



9
10
11
# File 'lib/turn/decorators/topten_decorator.rb', line 9

def method_missing(m,*args,&block)
  @reporter.send(m,*args,&block)
end

Instance Method Details

#finish_suite(suite) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/turn/decorators/topten_decorator.rb', line 28

def finish_suite(suite)
  @reporter.finish_suite(suite)
  io.puts
  io.puts Colorize.bold("Top 10 Longest Running Tests")
  top_ten_times.each do |(test_name, time)|
    io.print format_time(time)
    io.puts format_test_name(test_name, time)
  end
  io.puts
end

#finish_test(test) ⇒ Object



23
24
25
26
# File 'lib/turn/decorators/topten_decorator.rb', line 23

def finish_test(test)
  @reporter.finish_test(test)
  test_time_data[test_key(test)][:end] = Time.now
end

#start_case(kase) ⇒ Object



13
14
15
16
# File 'lib/turn/decorators/topten_decorator.rb', line 13

def start_case(kase)
  @reporter.start_case(kase)
  @top_ten_current_case = kase
end

#start_test(test) ⇒ Object



18
19
20
21
# File 'lib/turn/decorators/topten_decorator.rb', line 18

def start_test(test)
  @reporter.start_test(test)
  test_time_data[test_key(test)] = {:start => Time.now}
end