Skip to content

Commit

Permalink
stylesheet_link_tag('/stylesheets/application') and similar helpers d…
Browse files Browse the repository at this point in the history
…oesn't throw Sprockets::FileOutsidePaths exception anymore
  • Loading branch information
spastorino committed Oct 5, 2011
1 parent cf4d166 commit 4f2c238
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/lib/sprockets/helpers/rails_helper.rb
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/template/sprockets_helper_test.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 4f2c238

Please sign in to comment.