Module: RSpec::SleepingKingStudios::Concerns::MemoizedHelpers

Defined in:
lib/rspec/sleeping_king_studios/concerns/memoized_helpers.rb

Overview

Methods for defining memoized helpers in example groups.

Instance Method Summary collapse

Instance Method Details

#let?(method_name) ⇒ Boolean

Defines a memoized helper if a method of the same name is not defined.

Parameters:

  • method_name (String)

    the name of the helper method.

Yield Returns:

  • (Object)

    the value of the memoized helper method.

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/rspec/sleeping_king_studios/concerns/memoized_helpers.rb', line 13

def let?(method_name, &)
  return method_name if method_defined?(method_name)

  let(method_name, &)
end