Sha256: 45b2636cadf4e42d0f393d59ab823a1773fffbba30fb15f4220e91b0f8193584

Contents?: true

Size: 819 Bytes

Versions: 8

Compression:

Stored size: 819 Bytes

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")
require 'stringio'

include Handlers

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

def with_parser(parser_type, &block)
  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

8 entries across 7 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/spec/handlers/spec_helper.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/handlers/spec_helper.rb
yard-0.9.5 spec/handlers/spec_helper.rb
yard-0.9.4 spec/handlers/spec_helper.rb
yard-0.9.3 spec/handlers/spec_helper.rb
yard-0.9.2 spec/handlers/spec_helper.rb
yard-0.9.1 spec/handlers/spec_helper.rb
yard-0.9.0 spec/handlers/spec_helper.rb