diff options
| author | Seba Gamboa <[email protected]> | 2015-09-23 14:24:03 -0300 |
|---|---|---|
| committer | Seba Gamboa <[email protected]> | 2015-09-23 14:24:03 -0300 |
| commit | aed91b0fb2fe3c2cd3a74e2e5bc23c8bd95ef1db (patch) | |
| tree | 880d0eb2d6ec5d949f4a0ae72980687dd9041740 /spec/handlers/spec_helper.rb | |
| parent | 731c5326b47b34364b2a8f69c6d558f52957a562 (diff) | |
| download | yard-mruby-aed91b0fb2fe3c2cd3a74e2e5bc23c8bd95ef1db.tar.gz yard-mruby-aed91b0fb2fe3c2cd3a74e2e5bc23c8bd95ef1db.zip | |
Making specs works
Diffstat (limited to 'spec/handlers/spec_helper.rb')
| -rw-r--r-- | spec/handlers/spec_helper.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/handlers/spec_helper.rb b/spec/handlers/spec_helper.rb new file mode 100644 index 0000000..1eba194 --- /dev/null +++ b/spec/handlers/spec_helper.rb @@ -0,0 +1,31 @@ +require_relative '../spec_helper' +require 'stringio' + +def undoc_error(code) + lambda { StubbedSourceParser.parse_string(code) }.should 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 < YARD::Handlers::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 < YARD::Parser::SourceParser + StubbedSourceParser.parser_type = :ruby + def post_process + post = StubbedProcessor.new(self) + post.process(@parser.enumerator) + end +end |
