spec/code_objects/proxy_spec.rb in yard-0.8.1 vs spec/code_objects/proxy_spec.rb in yard-0.8.2
- old
+ new
@@ -76,15 +76,32 @@
Proxy.should === obj
obj.type = :class
obj.type.should == :class
end
- it "should retain a type change between Proxy objects" do
+ it "should NOT retain a type change between Proxy objects" do
P("InvalidClass").type = :class
- P("InvalidClass").type.should == :class
+ P("InvalidClass").type.should == :proxy
end
+ it "should use type to ensure resolved object is of intended type" do
+ YARD.parse_string <<-eof
+ module Foo
+ class Bar; end
+ def self.Bar; end
+ end
+ eof
+ proxy = Proxy.new(P('Foo'), 'Bar')
+ proxy.type = :method
+ proxy.path.should == 'Foo.Bar'
+ end
+
+ it "should allow type in initializer" do
+ Proxy.new(Registry.root, 'Foo', :method).type.should == :method
+ P(Registry.root, 'Foo', :method).type.should == :method
+ end
+
it "should never equal Registry.root" do
P("MYPROXY").should_not == Registry.root
P("X::A").should_not == Registry.root
end
@@ -110,10 +127,9 @@
quxbar = ModuleObject.new(qux, :Bar)
# Now it should resolve
proxy.type.should == :module
end
-
it "should handle constant names in namespaces" do
YARD.parse_string <<-eof
module A; end; B = A
module B::C; def foo; end end