class Test::Recorder

Recorder class is an observer that tracks all tests that are run and categorizes them according to their test status.

Public Class Methods

new() click to toggle source
# File lib/rubytest/recorder.rb, line 8
def initialize
  @table = Hash.new{ |h,k| h[k] = [] }
end

Public Instance Methods

[](key) click to toggle source
# File lib/rubytest/recorder.rb, line 12
def [](key)
  @table[key.to_sym]
end
error(test, exception) click to toggle source
# File lib/rubytest/recorder.rb, line 30
def error(test, exception)
  self[:error] << [test, exception]
end
fail(test, exception) click to toggle source
# File lib/rubytest/recorder.rb, line 26
def fail(test, exception)
  self[:fail] << [test, exception]
end
method_missing(*a) click to toggle source

Ignore any other signals.

# File lib/rubytest/recorder.rb, line 48
def method_missing(*a)
end
pass(test) click to toggle source

Add ‘test` to pass set.

# File lib/rubytest/recorder.rb, line 22
def pass(test)
  self[:pass] << test
end
skip_test(test, reason) click to toggle source
# File lib/rubytest/recorder.rb, line 17
def skip_test(test, reason)
  self[:skip] << [test, reason]
end
success?() click to toggle source

Returns true if their are no test errors or failures.

# File lib/rubytest/recorder.rb, line 43
def success?
  self[:error].size + self[:fail].size > 0 ? false : true
end
todo(test, exception) click to toggle source
# File lib/rubytest/recorder.rb, line 34
def todo(test, exception)
  self[:todo] << [test, exception]
end