From 5266eb9f611a114663c48eec0680b7050181d3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Oko=C5=84ski?= Date: Mon, 12 Dec 2011 16:52:56 +0100 Subject: Default relative_url_root to ENV["RAILS_RELATIVE_URL_ROOT"]. Fixes #3365 --- railties/test/application/assets_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'railties/test') diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 392bef3fd1..a08ea77ff3 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -478,6 +478,15 @@ module ApplicationTests assert_match 'src="//example.com/assets/rails.png"', File.read("#{app_path}/public/assets/image_loader.js") end + test "asset paths should use RAILS_RELATIVE_URL_ROOT by default" do + ENV["RAILS_RELATIVE_URL_ROOT"] = "/sub/uri" + + app_file "app/assets/javascripts/app.js.erb", 'var src="<%= image_path("rails.png") %>";' + add_to_config "config.assets.precompile = %w{app.js}" + precompile! + + assert_match 'src="/sub/uri/assets/rails.png"', File.read("#{app_path}/public/assets/app.js") + end private -- cgit v1.2.3