Class: JayUnit::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_unit.rb

Overview

This is the class you inherit from. And define a method called test can also override setup so that you can have some instance vars around

Instance Method Summary collapse

Constructor Details

#initializeTest

Returns a new instance of Test.



48
49
50
51
52
53
54
55
# File 'lib/jay_unit.rb', line 48

def initialize
  $ses = 0
  $fls = 0
  _setup
  setup
  _start
  run
end

Instance Method Details

#note(arg) ⇒ Object

proxy methods



63
64
65
# File 'lib/jay_unit.rb', line 63

def note arg
  JayUnit.note arg
end

#phail(arg) ⇒ Object



69
70
71
# File 'lib/jay_unit.rb', line 69

def phail arg
  JayUnit.phail arg
end

#reportObject



77
78
79
80
81
82
83
84
# File 'lib/jay_unit.rb', line 77

def report
  s = %Q[
--------------- RESULTS ------------------
SUCCESSES: #{$ses}          PHAILURES:#{$fls}
------------------------------------------
  ]
  puts s
end

#runObject

You must override this method



59
60
61
# File 'lib/jay_unit.rb', line 59

def run
  raise "You must override the run function in your class!"
end

#section(name, &block) ⇒ Object



72
73
74
75
76
# File 'lib/jay_unit.rb', line 72

def section name,&block
  puts "------* [#{name}] *------"
  yield
  report
end

#setupObject



56
57
58
# File 'lib/jay_unit.rb', line 56

def setup
  # You must override this method
end

#succeed(arg) ⇒ Object



66
67
68
# File 'lib/jay_unit.rb', line 66

def succeed arg
  JayUnit.succeed arg
end