Module: AutoTest::Error

Defined in:
lib/error.rb

Class Method Summary collapse

Class Method Details

.get_error ⇒ Object



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

def get_error
  @error[0]
end

.get_error_messages ⇒ Object



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

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



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

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_error ⇒ Object



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

def init_error
  @error = [0]
end


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

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