spec/code_objects/proxy_spec.rb in yard-0.9.20 vs spec/code_objects/proxy_spec.rb in yard-0.9.21
- old
+ new
@@ -2,9 +2,15 @@
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::Proxy do
before { Registry.clear }
+ it "does not allow constants to be used as a namespace if they do not resolve to a valid namespace" do
+ a = ConstantObject.new(:root, :A)
+ a.value = "$$INVALID$$"
+ expect { P("A::MyClass") }.to raise_error(Parser::UndocumentableError)
+ end
+
it "returns the object if it's in the Registry" do
ModuleObject.new(:root, :YARD)
proxyobj = P(:root, :YARD)
expect(proxyobj.type).to eq :module
expect(Proxy === proxyobj).to be false