When writing integration tests for a Rack app, I would like to test the app with all the middlewares that are enabled in runtime environment through classic config.ru file.
Using rack-app, I can instantiate the Rack app with:
describe App do
include Rack::App::Test
rack_app described_class
describe '/hello' do
get '/example/endpoint/'
# ...
end
end
With naked rack, it would look the same:
include Rack::Test::Methods
let(:app) { Application }
But then there are no enabled middlewares since the app is not instantiated through config.ru where use commands enable them.
How to enable the middlewares in tests so that the requests run through them in examples?