Module: DTest::DSL

Defined in:
lib/dtest/dsl.rb

Instance Method Summary collapse

Instance Method Details

#GlobalHarness(&block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dtest/dsl.rb', line 14

def GlobalHarness(&block)
  manager = Global::Manager::instance
  if manager.defined
    file, line, = DTest::failure_line(caller(1).first)
    str = ['GlobalHarness can only be only defined once.']
    str << " error at #{file}:#{line}" if file && line
    raise str.join("\n")
  else
    manager.instance_eval(&block)
    manager.defined = true
  end
end

#SharedContext(name, option = {}, &block) ⇒ Object



27
28
29
30
# File 'lib/dtest/dsl.rb', line 27

def SharedContext(name, option = {}, &block)
  manager = SharedContext::Manager::instance
  manager.add(name, option, &block)
end

#TestCase(name, options = {}, &block) ⇒ Object



8
9
10
11
12
# File 'lib/dtest/dsl.rb', line 8

def TestCase(name, options = {}, &block)
  manager = Test::Manager::instance
  manager.instance_eval(&block)
  manager.add(name)
end