Skip to content

Commit

Permalink
Fix Issue #342
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Winkler committed May 9, 2011
1 parent 9575db6 commit 7a79ab7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/asset_tag_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -872,14 +872,14 @@ def determine_source(source, collection)


def ensure_stylesheet_sources!(sources) def ensure_stylesheet_sources!(sources)
sources.each do |source| sources.each do |source|
asset_file_path!(path_to_stylesheet(source)) asset_file_path!(compute_public_path(source, 'stylesheets', 'css', false))
end end
return sources return sources
end end


def ensure_javascript_sources!(sources) def ensure_javascript_sources!(sources)
sources.each do |source| sources.each do |source|
asset_file_path!(path_to_javascript(source)) asset_file_path!(compute_public_path(source, 'javascripts', 'js', false))
end end
return sources return sources
end end
Expand Down
28 changes: 27 additions & 1 deletion actionpack/test/template/asset_tag_helper_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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')) FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
end 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"] = "" ENV["RAILS_ASSET_ID"] = ""
@controller.config.relative_url_root = "/collaboration/hieraki" @controller.config.relative_url_root = "/collaboration/hieraki"
config.perform_caching = true config.perform_caching = true
Expand All @@ -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')) FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
end 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 def test_caching_javascript_include_tag_when_caching_off
ENV["RAILS_ASSET_ID"] = "" ENV["RAILS_ASSET_ID"] = ""
config.perform_caching = false config.perform_caching = false
Expand Down Expand Up @@ -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')) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
end 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 end


class AssetTagHelperNonVhostTest < ActionView::TestCase class AssetTagHelperNonVhostTest < ActionView::TestCase
Expand Down

0 comments on commit 7a79ab7

Please sign in to comment.