Class: Test::Unit::TestCase

Inherits:
Object show all
Defined in:
lib/mack/testing/test_case.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#log_end(name = "") ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/mack/testing/test_case.rb', line 34

def log_end(name = "")                 
  @log_end_time = Time.now
  puts "#{format_log_time(@log_end_time)}: Ending\t#{name}"
  et = @log_end_time - @log_start_time
  suffix = ""
  et.round.times { suffix += "!" } if et > 1.0
  if et > 0.5
    puts "#{suffix}Elapsed Time: #{et} seconds#{suffix}"
  end
end

#log_start(name = "") ⇒ Object



29
30
31
32
# File 'lib/mack/testing/test_case.rb', line 29

def log_start(name = "")
  @log_start_time = Time.now      
  puts "\n#{format_log_time(@log_start_time)}: Starting\t#{name}"
end

#nameObject

:nodoc:



5
6
7
# File 'lib/mack/testing/test_case.rb', line 5

def name # :nodoc:
  "#{self.class.name}\t\t#{@method_name}"
end

#run(result, &progress_block) ⇒ Object

We need to wrap the run method so we can do things like run a cleanup method if it exists



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mack/testing/test_case.rb', line 15

def run(result, &progress_block) # :nodoc:
  super_run(result) do |state, name|
    in_session do
      if state == Test::Unit::TestCase::STARTED
        cleanup if self.respond_to?(:cleanup)
        log_start(name)
      else
        cleanup if self.respond_to?(:cleanup)
        log_end(name)
      end
    end
  end
end