Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #342: AssetTagHelper ensures that files are in the wrong directory (again) #465

Merged
merged 1 commit into from

2 participants

@svenwin

use compute_public_path by pkmiec

@josevalim josevalim merged commit f1d09a2 into rails:3-0-stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 9, 2011
  1. @svenwin

    Fix Issue #342

    svenwin authored
This page is out of date. Refresh to see the latest.
View
4 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -872,14 +872,14 @@ def determine_source(source, collection)
def ensure_stylesheet_sources!(sources)
sources.each do |source|
- asset_file_path!(path_to_stylesheet(source))
+ asset_file_path!(compute_public_path(source, 'stylesheets', 'css', false))
end
return sources
end
def ensure_javascript_sources!(sources)
sources.each do |source|
- asset_file_path!(path_to_javascript(source))
+ asset_file_path!(compute_public_path(source, 'javascripts', 'js', false))
end
return sources
end
View
28 actionpack/test/template/asset_tag_helper_test.rb
@@ -688,7 +688,7 @@ def test_caching_javascript_include_tag_with_all_puts_defaults_at_the_start_of_t
FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
end
- def test_caching_javascript_include_tag_with_relative_url_root
+ def def test_caching_javascript_include_tag_when_caching_is_on_with_relative_url_root
ENV["RAILS_ASSET_ID"] = ""
@controller.config.relative_url_root = "/collaboration/hieraki"
config.perform_caching = true
@@ -712,6 +712,19 @@ def test_caching_javascript_include_tag_with_relative_url_root
FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
end
+ def test_caching_javascript_include_tag_when_caching_off_with_relative_url_root
+ ENV["RAILS_ASSET_ID"] = ""
+ config.perform_caching = false
+ @controller.config.relative_url_root = "/collaboration/hieraki"
+
+ assert_dom_equal(
+ %(<script src="/collaboration/hieraki/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/effects.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/controls.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/bank.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/robber.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/version.1.0.js" type="text/javascript"></script>\n<script src="/collaboration/hieraki/javascripts/application.js" type="text/javascript"></script>),
+ javascript_include_tag(:all, :cache => true)
+ )
+
+ assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
+ end
+
def test_caching_javascript_include_tag_when_caching_off
ENV["RAILS_ASSET_ID"] = ""
config.perform_caching = false
@@ -956,6 +969,19 @@ def test_caching_stylesheet_include_tag_when_caching_off
assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
end
+
+ def test_caching_stylesheet_include_tag_when_caching_off_with_relative_url_root
+ ENV["RAILS_ASSET_ID"] = ""
+ config.perform_caching = false
+ @controller.config.relative_url_root = "/collaboration/hieraki"
+
+ assert_dom_equal(
+ %(<link href="/collaboration/hieraki/stylesheets/bank.css" media="screen" rel="stylesheet" type="text/css" />\n<link href="/collaboration/hieraki/stylesheets/robber.css" media="screen" rel="stylesheet" type="text/css" />\n<link href="/collaboration/hieraki/stylesheets/version.1.0.css" media="screen" rel="stylesheet" type="text/css" />),
+ stylesheet_link_tag(:all, :cache => true)
+ )
+
+ assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
+ end
end
class AssetTagHelperNonVhostTest < ActionView::TestCase
Something went wrong with that request. Please try again.