Module: Lemon::DSL

Defined in:
lib/lemon.rb

Overview

Lemon's toplevel test domain specific language.

Instance Method Summary collapse

Instance Method Details

#covers(script) ⇒ Object Also known as: Covers

Require script and record it.

Parameters:

  • script (STRING)

    The load path of a script.



20
21
22
23
# File 'lib/lemon.rb', line 20

def covers(script)
  # TODO: record coverage list
  require script
end

#test_case(target) { ... } ⇒ Object Also known as: TestCase, testcase

Define a class/module test case.

Parameters:

  • target (Module, Class)

    The class or module the tests will target.

Yields:

  • Scope in which to define unit/method testcases.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lemon.rb', line 34

def test_case(target, &block)
  case target
  when Class
    $TEST_SUITE << Lemon::TestClass.new(:target=>target, &block)
  when Module
    $TEST_SUITE << Lemon::TestModule.new(:target=>target, &block)
  else
    if defined?(super)
      super(target, &block)
    else
      raise
    end
  end
end