spec/grape/reload/watcher_spec.rb in grape-reload-0.0.2 vs spec/grape/reload/watcher_spec.rb in grape-reload-0.0.3
- old
+ new
@@ -4,10 +4,11 @@
describe Grape::Reload::Watcher do
def app; @app end
before(:example) do
@app =
Grape::RackBuilder.setup do
+ add_source_path File.expand_path('**.rb', APP_ROOT)
add_source_path File.expand_path('**/*.rb', APP_ROOT)
environment 'development'
reload_threshold 0
mount 'Test::App1', to: '/test1'
mount 'Test::App2', to: '/test2'
@@ -37,9 +38,23 @@
with_changed_fixture 'app1/mounts/mount.rb' do
get '/test1/mounted/test1'
expect(last_response).to succeed
expect(last_response.body).to eq('mounted test1 changed')
+ end
+ end
+
+ it 'remounts class on different root' do
+ get '/test2/mounted/test'
+ expect(last_response).to succeed
+ expect(last_response.body).to eq('test')
+
+ with_changed_fixture 'app2/test2.rb' do
+ get '/test2/mounted/test'
+ expect(last_response).to_not succeed
+
+ get '/test2/mounted2/test'
+ expect(last_response).to succeed
end
end
it 'reloads library file and reinits all affected APIs' do
with_changed_fixture 'app1/test1.rb' do
\ No newline at end of file