spec/unit/yardcheck/const_spec.rb in yardcheck-0.0.1 vs spec/unit/yardcheck/const_spec.rb in yardcheck-0.0.2

- old
+ new

@@ -6,14 +6,21 @@ module Foo module Bar module Baz end # Baz + + class Hash + end # Hash end # Bar end # Foo end + it 'resolves Object' do + expect(described_class.resolve('')).to eql(described_class.new(Object)) + end + it 'resolves top level constant' do expect(described_class.resolve('Foo')).to eql(described_class.new(Foo)) end it 'resolves namespaced constant with qualified top level parent' do @@ -42,7 +49,14 @@ it 'returns an invalid const object when given an unresolveable reference' do expect(described_class.resolve('What', Foo::Bar)).to eql( described_class::Invalid.new(Foo::Bar, 'What') ) + end + + it 'special cases Hash' do + aggregate_failures do + expect(described_class.resolve('Hash', Foo::Bar)).to eql(described_class.new(Hash)) + expect(described_class.resolve('Bar::Hash', Foo)).to eql(described_class.new(Foo::Bar::Hash)) + end end end