1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
# frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Handlers::Processor do
before do
@proc = Handlers::Processor.new(YARD::OpenStruct.new(:parser_type => :ruby))
end
it "starts with public visibility" do
expect(@proc.visibility).to eq :public
end
it "starts in instance scope" do
expect(@proc.scope).to eq :instance
end
it "starts in root namespace" do
expect(@proc.namespace).to eq Registry.root
end
it "has a globals structure" do
expect(@proc.globals).to be_a(YARD::OpenStruct)
end
it "ignores HandlerAborted exceptions (but print debug info)" do
class AbortHandlerProcessor < YARD::Handlers::Ruby::Base
process { abort! }
end
stmt = OpenStruct.new(:line => 1, :show => 'SOURCE')
allow(@proc).to receive(:find_handlers).and_return([AbortHandlerProcessor])
expect(log).to receive(:debug).with(/AbortHandlerProcessor cancelled from/)
expect(log).to receive(:debug).with("\tin file '(stdin)':1:\n\nSOURCE\n")
@proc.process([stmt])
end
end
|