Sha256: e5b12e1062665075c5d13d9ee7c0a3f0abbe618e4a6ba6bdd6d795fa0f28ab4c

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true
require 'stringio'

include Handlers

def undoc_error(code)
  expect { StubbedSourceParser.parse_string(code) }.to raise_error(Parser::UndocumentableError)
end

def with_parser(parser_type)
  tmp = StubbedSourceParser.parser_type
  StubbedSourceParser.parser_type = parser_type
  yield
  StubbedSourceParser.parser_type = tmp
end

class StubbedProcessor < Processor
  def process(statements)
    statements.each_with_index do |stmt, _index|
      find_handlers(stmt).each do |handler|
        handler.new(self, stmt).process
      end
    end
  end
end

class StubbedSourceParser < Parser::SourceParser
  StubbedSourceParser.parser_type = :ruby
  def post_process
    post = StubbedProcessor.new(self)
    post.process(@parser.enumerator)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yard-0.9.18 spec/handlers/spec_helper.rb
yard-0.9.17 spec/handlers/spec_helper.rb