1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

stylesheet_link_tag('/stylesheets/application') and similar helpers doesn't throw Sprockets::FileOutsidePaths exception anymore

This commit is contained in:
Santiago Pastorino 2011-10-05 15:41:28 -02:00
parent c495bfc127
commit fd8f0b2978
2 changed files with 7 additions and 0 deletions

View file

@ -123,6 +123,8 @@ module Sprockets
return nil if is_uri?(source) return nil if is_uri?(source)
source = rewrite_extension(source, nil, ext) source = rewrite_extension(source, nil, ext)
asset_environment[source] asset_environment[source]
rescue Sprockets::FileOutsidePaths
nil
end end
def digest_for(logical_path) def digest_for(logical_path)

View file

@ -219,6 +219,8 @@ class SprocketsHelperTest < ActionView::TestCase
@config.assets.compile = true @config.assets.compile = true
@config.assets.debug = 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>}, 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) javascript_include_tag(:application)
end end
@ -264,6 +266,9 @@ class SprocketsHelperTest < ActionView::TestCase
@config.assets.compile = true @config.assets.compile = true
@config.assets.debug = 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" />}, 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) stylesheet_link_tag(:application)