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.



34
35
36
37
# File 'lib/lemon.rb', line 34

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.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/lemon.rb', line 48

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