class Test::Unit::TestCase

Contest adds teardown, test and context as class methods, and the instance methods setup and teardown now iterate on the corresponding blocks. Note that all setup and teardown blocks must be defined with the block syntax. Adding setup or teardown instance methods defeats the purpose of this library.

Public Class Methods

context(*name, &block) click to toggle source
# File lib/contest.rb, line 33
def self.context(*name, &block)
  subclass = Class.new(self)
  remove_tests(subclass)
  subclass.class_eval(&block) if block_given?
  const_set(context_name(name.join(" ")), subclass)
end
Also aliased as: describe
describe(*name, &block) click to toggle source
Alias for: context
setup(&block) click to toggle source
# File lib/contest.rb, line 19
def self.setup(&block)
  define_method :setup do
    super(&block)
    instance_eval(&block)
  end
end
should(name, &block) click to toggle source
Alias for: test
teardown(&block) click to toggle source
# File lib/contest.rb, line 26
def self.teardown(&block)
  define_method :teardown do
    instance_eval(&block)
    super(&block)
  end
end
test(name, &block) click to toggle source
# File lib/contest.rb, line 40
def self.test(name, &block)
  define_method(test_name(name), &block)
end
Also aliased as: should