Module: Kernel

Defined in:
lib/kernel.rb

Overview

Extension of the global Kernel module to provide the Fix method. This allows Fix to be called from anywhere in the application without explicit namespace qualification.

Instance Method Summary collapse

Instance Method Details

#Fix(name = nil) { ... } ⇒ Fix::Set

Defines a new test specification or creates an anonymous specification set. When a name is provided, the specification is registered globally and can be referenced later using Fix. Anonymous specifications are executed immediately and cannot be referenced later.

Examples:

Creating a named specification for later use

Fix :Calculator do
  on(:add, 2, 3) do
    it MUST equal 5
  end
end

# Later in the code:
Fix[:Calculator].test { Calculator.new }

Creating and immediately testing an anonymous specification

Fix do
  it MUST be_positive
end.test { 42 }

Yields:

  • The specification definition block

Yield Returns:

  • (void)

See Also:



44
45
46
# File 'lib/kernel.rb', line 44

def Fix(name = nil, &)
  ::Fix::Builder.build(name, &)
end