aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2013-01-21 21:21:39 +0100
committerPiotr Sarnacki <drogus@gmail.com>2013-01-21 21:21:39 +0100
commit445f14e97553de552745de26ebd5e49bc5c82f4e (patch)
treef35bfb4e877a9d51d91d0c78e6ff725536f6badb /railties
parent5984894fc9779ce625c9264d32d77581bd6c52ba (diff)
downloadrails-445f14e97553de552745de26ebd5e49bc5c82f4e.tar.gz
rails-445f14e97553de552745de26ebd5e49bc5c82f4e.tar.bz2
rails-445f14e97553de552745de26ebd5e49bc5c82f4e.zip
Fix asset_path in mounted engine
Historically serving assets from a mountable engine could be achieved by running ActionDispatch::Static as a part of engine middleware stack or to copy assets prefixed with an engine name. After introduction of assets pipeline this is not needed as all of the assets are served or compiled into main application's assets. This commit removes the obsolete line making asset_path always generate paths relative to the root or config.relative_url_root if it's set. (closes #8119)
Diffstat (limited to 'railties')
-rw-r--r--railties/test/railties/mounted_engine_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb
index a1c52f01dc..80559a6e36 100644
--- a/railties/test/railties/mounted_engine_test.rb
+++ b/railties/test/railties/mounted_engine_test.rb
@@ -89,6 +89,7 @@ module ApplicationTests
get '/generate_application_route', to: 'posts#generate_application_route'
get '/application_route_in_view', to: 'posts#application_route_in_view'
get '/engine_polymorphic_path', to: 'posts#engine_polymorphic_path'
+ get '/engine_asset_path', to: 'posts#engine_asset_path'
end
RUBY
@@ -113,6 +114,10 @@ module ApplicationTests
def engine_polymorphic_path
render text: polymorphic_path(Post.new)
end
+
+ def engine_asset_path
+ render inline: "<%= asset_path 'images/foo.png' %>"
+ end
end
end
RUBY
@@ -211,6 +216,10 @@ module ApplicationTests
# and in an application
get "/application_polymorphic_path"
assert_equal "/posts/44", last_response.body
+
+ # test that asset path will not get script_name when generated in the engine
+ get "/someone/blog/engine_asset_path"
+ assert_equal "/images/foo.png", last_response.body
end
test "route path for controller action when engine is mounted at root" do