Module: Kernel

Defined in:
lib/kernel.rb

Overview

The Kernel module.

Instance Method Summary collapse

Instance Method Details

#Fix(name = nil) { ... } ⇒ #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.

Yields:

  • The specifications block that defines the test requirements

Yield Returns:

  • (void)

Returns:

  • (#test)

    The collection of specifications.



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

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