diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-08 12:57:07 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-08 12:59:04 +0200 |
commit | 80bf68aa1ba7aea9aded5094e81af05b159ceaa4 (patch) | |
tree | f31b4072204f6f3839de8fd219017b42cd243f7e /railties/test/application | |
parent | c2b55c4fbfc427e9ca468fce0392de591c87747a (diff) | |
download | rails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.tar.gz rails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.tar.bz2 rails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.zip |
prepend the assets route instead of appending, closes #436
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/assets_test.rb | 27 | ||||
-rw-r--r-- | railties/test/application/routing_test.rb | 4 |
2 files changed, 29 insertions, 2 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb new file mode 100644 index 0000000000..b03dc3132b --- /dev/null +++ b/railties/test/application/assets_test.rb @@ -0,0 +1,27 @@ +require 'isolation/abstract_unit' +require 'rack/test' + +module ApplicationTests + class RoutingTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + include Rack::Test::Methods + + def setup + build_app + boot_rails + end + + test "assets routes have higher priority" do + app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();" + + app_file 'config/routes.rb', <<-RUBY + AppTemplate::Application.routes.draw do + match '*path', :to => lambda { |env| [200, { "Content-Type" => "text/html" }, "Not an asset"] } + end + RUBY + + get "/assets/demo.js" + assert_match "alert()", last_response.body + end + end +end diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb index 62589c998d..e3a7f8a63c 100644 --- a/railties/test/application/routing_test.rb +++ b/railties/test/application/routing_test.rb @@ -1,14 +1,14 @@ require 'isolation/abstract_unit' +require 'rack/test' module ApplicationTests class RoutingTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation + include Rack::Test::Methods def setup build_app boot_rails - require 'rack/test' - extend Rack::Test::Methods end test "rails/info/properties in development" do |