Module: Kernel

Defined in:
lib/kernel_extensions.rb

Defined Under Namespace

Modules: Infinity, NaN

Constant Summary collapse

METHODS_WITH_INLINE_TESTS =
[]
METHODS_THAT_NEED_TESTS =
[]
RUN_TESTS_IN_THIS_ENVIRONMENT =
true

Instance Method Summary collapse

Instance Method Details

#tested(method_name, _ignored, &inline_test_block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/kernel_extensions.rb', line 7

def tested(method_name, _ignored, &inline_test_block)
  return unless RUN_TESTS_IN_THIS_ENVIRONMENT

  method = method_ref(method_name)

  # Register the method's tests to be run with InlineTests
  method.inline_tests = inline_test_block
  METHODS_WITH_INLINE_TESTS << method

  method
end

#testsObject



18
# File 'lib/kernel_extensions.rb', line 18

def tests; end

#untested(method_name) ⇒ Object

This is just syntax sugar for decorating methods that are untested / need tests



21
22
23
24
# File 'lib/kernel_extensions.rb', line 21

def untested(method_name)
  method = method_ref(method_name)
  METHODS_THAT_NEED_TESTS.push method
end