Skip to content
Browse files

stylesheet_link_tag('/stylesheets/application') and similar helpers d…

…oesn't throw Sprockets::FileOutsidePaths exception anymore
  • Loading branch information...
1 parent cf4d166 commit 4f2c238f3a5dd55b3b903f4a5516fbe281a03cfa @spastorino spastorino committed Oct 5, 2011
View
2 actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -128,6 +128,8 @@ def asset_for(source, ext)
return nil if is_uri?(source)
source = rewrite_extension(source, nil, ext)
asset_environment[source]
+ rescue Sprockets::FileOutsidePaths
+ nil
end
def digest_for(logical_path)
View
5 actionpack/test/template/sprockets_helper_test.rb
@@ -222,6 +222,8 @@ def config
@config.assets.compile = true
@config.assets.debug = true
+ assert_match %r{<script src="/javascripts/application.js" type="text/javascript"></script>},
+ javascript_include_tag('/javascripts/application')
assert_match %r{<script src="/assets/xmlhr-[0-9a-f]+.js\?body=1" type="text/javascript"></script>\n<script src="/assets/application-[0-9a-f]+.js\?body=1" type="text/javascript"></script>},
javascript_include_tag(:application)
end
@@ -267,6 +269,9 @@ def config
@config.assets.compile = true
@config.assets.debug = true
+ assert_match %r{<link href="/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />},
+ stylesheet_link_tag('/stylesheets/application')
+
assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />},
stylesheet_link_tag(:application)

0 comments on commit 4f2c238

Please sign in to comment.
Something went wrong with that request. Please try again.