Module: AutoTest::Error

Included in:
AutoTest
Defined in:
lib/error.rb

Class Method Summary collapse

Class Method Details

.get_errorObject



36
37
38
# File 'lib/error.rb', line 36

def get_error
  @error[0]
end

.get_error_messagesObject



40
41
42
# File 'lib/error.rb', line 40

def get_error_messages
  @error[1..@error.size-1]
end

.inc_error(value) ⇒ Object

increment the errorcount in the first field of the array, add error messages



8
9
10
11
12
13
14
15
16
# File 'lib/error.rb', line 8

def inc_error(value)
  if !get_error_messages.include? value then
    @error[0] = @error[0] + 1
    @error << value
    if Test.stop_at_first_error? then
      Test.stop!
    end
  end
end

.init_errorObject



44
45
46
# File 'lib/error.rb', line 44

def init_error
  @error = [0]
end


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/error.rb', line 18

def print_errors
  if get_error > 0 then
    if get_error == 1 then
      puts "There was 1 Error in this test:"
      get_error_messages.each do |m|
        puts m
      end
    else
      puts "There were " + get_error.to_s + " Errors in this test:"
      get_error_messages.each do |m|
        puts m
      end      
    end
  else
    puts "There were no errors in this test"
  end
end