lib/rspec/arguments/monkey_patcher.rb
def instance
        __memoized.fetch_or_store(:instance) do
          metadata = self.class.metadata
          described = described_class || metadata.fetch(:description_args).first

          if described.is_a?(Class)
            if metadata[:rspec_arguments] || metadata[:method] || metadata[:class_method]
              raise 'Instance is only available when testing class instances or instance methods' if metadata[:class_method]

              call_initializer_with_args(described)
            else
              described.new
            end
          end
        end
      end
#
# Reference to the instantiated object, if testing an instance or instance method (but not class method).
#
Reference to the instantiated object, if testing an instance or instance method (but not class method).
Reference to the instantiated object if testing an instance or instance method ( but not class method ) .
def instance
        __memoized.fetch_or_store(:instance) do
          metadata = self.class.metadata
          described = described_class || metadata.fetch(:description_args).first
          if described.is_a?(Class)
            if metadata[:rspec_arguments] || metadata[:method] || metadata[:class_method]
              raise 'Instance is only available when testing class instances or instance methods' if metadata[:class_method]
              call_initializer_with_args(described)
            else
              described.new
            end
          end
        end
      end
def instance __memoized . fetch_or_store ( :instance ) do metadata = self . class . metadata described = described_class || metadata . fetch ( :description_args ) . first if described . is_a? ( Class ) if metadata [ :rspec_arguments ] || metadata [ :method ] || metadata [ :class_method ] raise 'Instance is only available when testing class instances or instance methods' if metadata [ :class_method ] call_initializer_with_args ( described ) else described . new end end end end
Reference to the instantiated object, if testing an instance or instance method (but not class method).
Reference to the instantiated object if testing an instance or instance method ( but not class method ) .