aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/asset_tag_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/asset_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index d586afdef6..f1dad9f50e 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -568,6 +568,36 @@ class AssetTagHelperTest < ActionView::TestCase
FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::ASSETS_DIR, 'absolute'))
end
+ def test_concat_stylesheet_link_tag_when_caching_off
+ ENV["RAILS_ASSET_ID"] = ""
+
+ assert_dom_equal(
+ %(<link href="/stylesheets/all.css" media="screen" rel="stylesheet" type="text/css" />),
+ stylesheet_link_tag(:all, :concat => true)
+ )
+
+ expected = Dir["#{ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR}/*.css"].map { |p| File.mtime(p) }.max
+ assert_equal expected, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
+
+ assert_dom_equal(
+ %(<link href="/stylesheets/money.css" media="screen" rel="stylesheet" type="text/css" />),
+ stylesheet_link_tag(:all, :concat => "money")
+ )
+
+ assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
+
+ assert_dom_equal(
+ %(<link href="/absolute/test.css" media="screen" rel="stylesheet" type="text/css" />),
+ stylesheet_link_tag(:all, :concat => "/absolute/test")
+ )
+
+ assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::ASSETS_DIR, 'absolute', 'test.css'))
+ ensure
+ FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
+ FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
+ FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::ASSETS_DIR, 'absolute'))
+ end
+
def test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }