module Minitest::Spec::DSL

def let name, &block

def let name, &block
  name = name.to_s
  raise ArgumentError, 'name cannot begin with "test"' if name =~ /\Atest/
  raise ArgumentError, "##{name} cannot be overridden" if
    (Minitest::Spec.instance_methods.map(&:to_s) - %w[subject]).include? name
  define_method name do
    @_memoized ||= {}
    @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
  end
end