Module: Kernel

Defined in:
lib/kernel.rb

Overview

The Kernel module.

Instance Method Summary collapse

Instance Method Details

#Fix(name = nil, &block) ⇒ #test

Specifications are built with this method.

Examples:

Require an answer equal to 42.

# The spec
Fix :Answer do
  it MUST equal 42
end

# A test
Fix[:Answer].test { 42 }

Parameters:

  • name (String, Symbol) (defaults to: nil)

    The constant name of the specifications.

  • block (Proc)

    The specifications.

Returns:

  • (#test)

    The collection of specifications.



28
29
30
31
32
33
34
# File 'lib/kernel.rb', line 28

def Fix(name = nil, &block)
  klass = ::Class.new(::Fix::Dsl)
  klass.const_set(:CONTEXTS, [klass])
  klass.instance_eval(&block)
  ::Fix::Doc.const_set(name, klass) unless name.nil?
  ::Fix::Set.new(*klass.const_get(:CONTEXTS))
end