Making Rails tests aware of Rack middleware outside Rails's internal chain
问题 Context : an application uses a piece of Rack middleware that must be setup in config.ru, rather than Rails's internal Middleware chain. This is for reasons not relevant to this question. Question : how do I make my tests (functional and integration) aware of this middleware? I'll ellaborate with an example. Let's create a pristine Rails 3 app, using rack-rewrite for illustration purposes. # /config/initializers/example.rb Rails.application.middleware.insert 0, 'Rack::Rewrite' do r301 '/so',