Sha256: 74b13d38bf4d58b5bd7da0635d88085e6dcccdd96f5acfd65bcbd68b3f0c6e73
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require 'grape' require 'spec_helper' 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) environment 'development' reload_threshold 0 mount 'Test::App1', to: '/test1' mount 'Test::App2', to: '/test2' end.boot!.application end after(:example) do Grape::Reload::Watcher.clear end it 'reloads changed root app file' do get '/test1/test' expect(last_response).to succeed expect(last_response.body).to eq('test1 response') with_changed_fixture 'app1/test1.rb' do get '/test1/test' expect(last_response).to succeed expect(last_response.body).to eq('test1 response changed') end end it 'reloads mounted app file' do get '/test1/mounted/test1' expect(last_response).to succeed expect(last_response.body).to eq('mounted test1') 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 'reloads library file and reinits all affected APIs' do with_changed_fixture 'app1/test1.rb' do get '/test1/lib_mounted/lib_string' expect(last_response).to succeed expect(last_response.body).to eq('lib string 1') with_changed_fixture 'lib/lib1.rb' do get '/test1/lib_mounted/lib_string' expect(last_response).to succeed expect(last_response.body).to eq('lib string 1 changed') expect(Test::LibMount1.endpoints.first.options[:route_options][:entity].first.get_lib_string).to eq('lib string 1 changed') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-reload-0.0.2 | spec/grape/reload/watcher_spec.rb |