diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-06 17:06:59 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-06 17:20:53 +0000 |
commit | c59734f756b79c39486c45273d2cc5d42cd0c864 (patch) | |
tree | 3fc32497850a341872b896c09a0c065f218b18d8 /railties/test/application | |
parent | 5a8f25f003f022ebc6986b20b0c10329e9553dc3 (diff) | |
download | rails-c59734f756b79c39486c45273d2cc5d42cd0c864.tar.gz rails-c59734f756b79c39486c45273d2cc5d42cd0c864.tar.bz2 rails-c59734f756b79c39486c45273d2cc5d42cd0c864.zip |
Invert precedence of content in ActionDispatch::Static
This commit inverts the precedence in ActionDispatch::Static so that
dynamic content will be served before static content. This is so that
precompiled assets do not inadvertently get included when running in
development mode - it should have no effect in production where static
files are usually handled by the web server.
Closes #6421
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/routing_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb index ffcdeac7f0..0550afdb40 100644 --- a/railties/test/application/routing_test.rb +++ b/railties/test/application/routing_test.rb @@ -268,5 +268,28 @@ module ApplicationTests get '/yazilar' assert_equal 200, last_response.status end + + test 'routes take precedence over static files' do + app('development') + + app_file 'config/routes.rb', <<-RUBY + AppTemplate::Application.routes.draw do + get 'foo', to: 'foo#index' + end + RUBY + + app_file 'public/foo.json', '{"foo":"bar"}' + + controller :foo, <<-RUBY + class FooController < ApplicationController + def index + render json: { foo: 'baz' } + end + end + RUBY + + get '/foo.json' + assert_equal '{"foo":"baz"}', last_response.body + end end end |