spec/ripper/extract_constants_spec.rb in grape-reload-0.0.2 vs spec/ripper/extract_constants_spec.rb in grape-reload-0.0.3
- old
+ new
@@ -51,11 +51,18 @@
get :test do
SomeClass.usage
'test2 response'
end
end
+ module EmptyModule
+ end
end
+ class WithoutModule
+ def use_top_level
+ TopLevel.new
+ end
+ end
CODE
}
it 'extract consts from code1 correctly' do
consts = Ripper.extract_constants(code1)
@@ -81,17 +88,18 @@
end
it 'extract consts from code2 correctly' do
consts = Ripper.extract_constants(code2)
expect(consts[:declared].flatten).to include(
- '::Test::App2'
+ '::Test::App2',
+ '::Test::EmptyModule'
)
expect(consts[:used].flatten).to include(
'::Test::Mount2',
'::Test::Mount10',
'::Test::SomeAnotherEntity',
- '::SomeClass'
+ '::SomeClass',
+ '::TopLevel'
)
-
end
end
\ No newline at end of file