aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/assets_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/assets_test.rb')
-rw-r--r--railties/test/application/assets_test.rb27
1 files changed, 27 insertions, 0 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