aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/asset_tag_helper_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-10-10 10:53:27 -0500
committerJoshua Peek <josh@joshpeek.com>2012-10-10 10:53:27 -0500
commit607829a3640324dd94f3a0a83fbef1f6b1f288b3 (patch)
tree6533a8053a44207cdaf512b468d88e9cad3bd8b8 /actionpack/test/template/asset_tag_helper_test.rb
parent27683b5259775c900057fe62d828f8742b1049d3 (diff)
downloadrails-607829a3640324dd94f3a0a83fbef1f6b1f288b3.tar.gz
rails-607829a3640324dd94f3a0a83fbef1f6b1f288b3.tar.bz2
rails-607829a3640324dd94f3a0a83fbef1f6b1f288b3.zip
Remove old asset tag concatenation
Use sprockets, jammit, or some other asset bundler
Diffstat (limited to 'actionpack/test/template/asset_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb752
1 files changed, 0 insertions, 752 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index a04694714d..754622c883 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -45,8 +45,6 @@ class AssetTagHelperTest < ActionView::TestCase
end.new
@controller.request = @request
-
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => ['prototype', 'effects', 'dragdrop', 'controls', 'rails']
end
def url_for(*args)
@@ -54,11 +52,7 @@ class AssetTagHelperTest < ActionView::TestCase
end
def teardown
- config.perform_caching = false
ENV.delete('RAILS_ASSET_ID')
-
- JavascriptIncludeTag.expansions.clear
- StylesheetIncludeTag.expansions.clear
end
AutoDiscoveryToTag = {
@@ -105,12 +99,6 @@ class AssetTagHelperTest < ActionView::TestCase
%(javascript_include_tag("bank.js")) => %(<script src="/javascripts/bank.js" ></script>),
%(javascript_include_tag("bank", :lang => "vbscript")) => %(<script lang="vbscript" src="/javascripts/bank.js" ></script>),
%(javascript_include_tag("common.javascript", "/elsewhere/cools")) => %(<script src="/javascripts/common.javascript" ></script>\n<script src="/elsewhere/cools.js" ></script>),
- %(javascript_include_tag(:defaults)) => %(<script src="/javascripts/prototype.js" ></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>),
- %(javascript_include_tag(:all)) => %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- %(javascript_include_tag(:all, :recursive => true)) => %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/subdir/subdir.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- %(javascript_include_tag(:defaults, "bank")) => %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/application.js"></script>),
- %(javascript_include_tag(:defaults, "application")) => %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>),
- %(javascript_include_tag("bank", :defaults)) => %(<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>),
%(javascript_include_tag("http://example.com/all")) => %(<script src="http://example.com/all"></script>),
%(javascript_include_tag("http://example.com/all.js")) => %(<script src="http://example.com/all.js"></script>),
@@ -151,9 +139,6 @@ class AssetTagHelperTest < ActionView::TestCase
%(stylesheet_link_tag("/elsewhere/file")) => %(<link href="/elsewhere/file.css" media="screen" rel="stylesheet" />),
%(stylesheet_link_tag("subdir/subdir")) => %(<link href="/stylesheets/subdir/subdir.css" media="screen" rel="stylesheet" />),
%(stylesheet_link_tag("bank", :media => "all")) => %(<link href="/stylesheets/bank.css" media="all" rel="stylesheet" />),
- %(stylesheet_link_tag(:all)) => %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- %(stylesheet_link_tag(:all, :recursive => true)) => %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/subdir/subdir.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- %(stylesheet_link_tag(:all, :media => "all")) => %(<link href="/stylesheets/bank.css" media="all" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="all" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="all" rel="stylesheet" />),
%(stylesheet_link_tag("random.styles", "/elsewhere/file")) => %(<link href="/stylesheets/random.styles" media="screen" rel="stylesheet" />\n<link href="/elsewhere/file.css" media="screen" rel="stylesheet" />),
%(stylesheet_link_tag("http://www.example.com/styles/style")) => %(<link href="http://www.example.com/styles/style" media="screen" rel="stylesheet" />),
@@ -339,93 +324,14 @@ class AssetTagHelperTest < ActionView::TestCase
}
assert_nothing_raised {
- javascript_include_tag(:defaults, 'missing_security_guard')
- }
-
- assert_nothing_raised {
javascript_include_tag('http://example.com/css/missing_security_guard')
}
end
- def test_javascript_include_tag_with_given_asset_id
- ENV["RAILS_ASSET_ID"] = "1"
- assert_dom_equal(%(<script src="/javascripts/prototype.js?1"></script>\n<script src="/javascripts/effects.js?1"></script>\n<script src="/javascripts/dragdrop.js?1"></script>\n<script src="/javascripts/controls.js?1"></script>\n<script src="/javascripts/rails.js?1"></script>\n<script src="/javascripts/application.js?1"></script>), javascript_include_tag(:defaults))
- end
-
def test_javascript_include_tag_is_html_safe
- assert javascript_include_tag(:defaults).html_safe?
assert javascript_include_tag("prototype").html_safe?
end
- def test_custom_javascript_expansions
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"]
- assert_dom_equal %(<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/effects.js"></script>), javascript_include_tag('controls', :robbery, 'effects')
- end
-
- def test_custom_javascript_expansions_return_unique_set
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => %w(prototype effects dragdrop controls rails application)
- assert_dom_equal %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag(:defaults)
- end
-
- def test_custom_javascript_expansions_and_defaults_puts_application_js_at_the_end
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"]
- assert_dom_equal %(<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag('controls',:defaults, :robbery, 'effects')
- end
-
- def test_javascript_include_tag_should_not_output_the_same_asset_twice
- ENV["RAILS_ASSET_ID"] = ""
- assert_dom_equal %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag('prototype', 'effects', :defaults)
- end
-
- def test_javascript_include_tag_should_not_output_the_same_expansion_twice
- ENV["RAILS_ASSET_ID"] = ""
- assert_dom_equal %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag(:defaults, :defaults)
- end
-
- def test_single_javascript_asset_keys_should_take_precedence_over_expansions
- ENV["RAILS_ASSET_ID"] = ""
- assert_dom_equal %(<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag('controls', :defaults, 'effects')
- assert_dom_equal %(<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/rails.js"></script>\n<script src="/javascripts/application.js"></script>), javascript_include_tag('controls', 'effects', :defaults)
- end
-
- def test_registering_javascript_expansions_merges_with_existing_expansions
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['bank']
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['robber']
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['bank']
- assert_dom_equal %(<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>), javascript_include_tag(:can_merge)
- end
-
- def test_custom_javascript_expansions_with_undefined_symbol
- assert_raise(ArgumentError) { javascript_include_tag('first', :unknown, 'last') }
- end
-
- def test_custom_javascript_expansions_with_nil_value
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => nil
- assert_dom_equal %(<script src="/javascripts/first.js"></script>\n<script src="/javascripts/last.js"></script>), javascript_include_tag('first', :monkey, 'last')
- end
-
- def test_custom_javascript_expansions_with_empty_array_value
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => []
- assert_dom_equal %(<script src="/javascripts/first.js"></script>\n<script src="/javascripts/last.js"></script>), javascript_include_tag('first', :monkey, 'last')
- end
-
- def test_custom_javascript_and_stylesheet_expansion_with_same_name
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"]
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :robbery => ["money", "security"]
- assert_dom_equal %(<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/effects.js"></script>), javascript_include_tag('controls', :robbery, 'effects')
- assert_dom_equal %(<link href="/stylesheets/style.css" rel="stylesheet" media="screen" />\n<link href="/stylesheets/money.css" rel="stylesheet" media="screen" />\n<link href="/stylesheets/security.css" rel="stylesheet" media="screen" />\n<link href="/stylesheets/print.css" rel="stylesheet" media="screen" />), stylesheet_link_tag('style', :robbery, 'print')
- end
-
- def test_reset_javascript_expansions
- JavascriptIncludeTag.expansions.clear
- assert_raise(ArgumentError) { javascript_include_tag(:defaults) }
- end
-
def test_all_javascript_expansion_not_include_application_js_if_not_exists
FileUtils.mv(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'application.js'),
File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'application.bak'))
@@ -478,57 +384,11 @@ class AssetTagHelperTest < ActionView::TestCase
assert_dom_equal %(<link href="/file.css" media="&lt;script&gt;" rel="stylesheet" />), stylesheet_link_tag('/file', :media => '<script>')
end
- def test_custom_stylesheet_expansions
- ENV["RAILS_ASSET_ID"] = ''
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :robbery => ["bank", "robber"]
- assert_dom_equal %(<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/subdir/subdir.css" media="screen" rel="stylesheet" />), stylesheet_link_tag('version.1.0', :robbery, 'subdir/subdir')
- end
-
- def test_custom_stylesheet_expansions_return_unique_set
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :cities => %w(wellington amsterdam london)
- assert_dom_equal %(<link href="/stylesheets/wellington.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/amsterdam.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/london.css" media="screen" rel="stylesheet" />), stylesheet_link_tag(:cities)
- end
-
def test_stylesheet_link_tag_should_not_output_the_same_asset_twice
ENV["RAILS_ASSET_ID"] = ""
assert_dom_equal %(<link href="/stylesheets/wellington.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/amsterdam.css" media="screen" rel="stylesheet" />), stylesheet_link_tag('wellington', 'wellington', 'amsterdam')
end
- def test_stylesheet_link_tag_should_not_output_the_same_expansion_twice
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :cities => %w(wellington amsterdam london)
- assert_dom_equal %(<link href="/stylesheets/wellington.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/amsterdam.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/london.css" media="screen" rel="stylesheet" />), stylesheet_link_tag(:cities, :cities)
- end
-
- def test_single_stylesheet_asset_keys_should_take_precedence_over_expansions
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :cities => %w(wellington amsterdam london)
- assert_dom_equal %(<link href="/stylesheets/london.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/wellington.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/amsterdam.css" media="screen" rel="stylesheet" />), stylesheet_link_tag('london', :cities)
- end
-
- def test_custom_stylesheet_expansions_with_unknown_symbol
- assert_raise(ArgumentError) { stylesheet_link_tag('first', :unknown, 'last') }
- end
-
- def test_custom_stylesheet_expansions_with_nil_value
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => nil
- assert_dom_equal %(<link href="/stylesheets/first.css" rel="stylesheet" media="screen" />\n<link href="/stylesheets/last.css" rel="stylesheet" media="screen" />), stylesheet_link_tag('first', :monkey, 'last')
- end
-
- def test_custom_stylesheet_expansions_with_empty_array_value
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => []
- assert_dom_equal %(<link href="/stylesheets/first.css" rel="stylesheet" media="screen" />\n<link href="/stylesheets/last.css" rel="stylesheet" media="screen" />), stylesheet_link_tag('first', :monkey, 'last')
- end
-
- def test_registering_stylesheet_expansions_merges_with_existing_expansions
- ENV["RAILS_ASSET_ID"] = ""
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :can_merge => ['bank']
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :can_merge => ['robber']
- ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :can_merge => ['bank']
- assert_dom_equal %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />), stylesheet_link_tag(:can_merge)
- end
-
def test_image_path
ImagePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
end
@@ -714,616 +574,6 @@ class AssetTagHelperTest < ActionView::TestCase
@controller.request.stubs(:ssl?).returns(true)
assert_equal "http://localhost/images/xml.png", image_path("xml.png")
end
-
- def test_caching_javascript_include_tag_when_caching_on
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = 'http://a0.example.com'
- config.perform_caching = true
-
- assert_dom_equal(
- %(<script src="http://a0.example.com/javascripts/all.js"></script>),
- javascript_include_tag(:all, :cache => true)
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="http://a0.example.com/javascripts/money.js"></script>),
- javascript_include_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
-
- assert_dom_equal(
- %(<script src="http://a0.example.com/absolute/test.js"></script>),
- javascript_include_tag(:all, :cache => "/absolute/test")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::ASSETS_DIR, 'absolute', 'test.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::ASSETS_DIR, 'absolute'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_with_proc_asset_host
- ENV['RAILS_ASSET_ID'] = ''
- @controller.config.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }
- config.perform_caching = true
-
- assert_equal '/javascripts/scripts.js'.length, 23
- assert_dom_equal(
- %(<script src="http://a23.example.com/javascripts/scripts.js"></script>),
- javascript_include_tag(:all, :cache => 'scripts')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_with_2_argument_proc_asset_host
- ENV['RAILS_ASSET_ID'] = ''
- @controller.config.asset_host = Proc.new { |source, request|
- if request.ssl?
- "#{request.protocol}#{request.host_with_port}"
- else
- "#{request.protocol}assets#{source.length}.example.com"
- end
- }
- config.perform_caching = true
-
- assert_equal '/javascripts/vanilla.js'.length, 23
- assert_dom_equal(
- %(<script src="http://assets23.example.com/javascripts/vanilla.js"></script>),
- javascript_include_tag(:all, :cache => 'vanilla')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'vanilla.js'))
-
- class << @controller.request
- def protocol() 'https://' end
- def ssl?() true end
- end
-
- assert_equal '/javascripts/secure.js'.length, 22
- assert_dom_equal(
- %(<script src="https://localhost/javascripts/secure.js"></script>),
- javascript_include_tag(:all, :cache => 'secure')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'secure.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'vanilla.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'secure.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_with_2_argument_object_asset_host
- ENV['RAILS_ASSET_ID'] = ''
- @controller.config.asset_host = Class.new do
- def call(source, request)
- if request.ssl?
- "#{request.protocol}#{request.host_with_port}"
- else
- "#{request.protocol}assets#{source.length}.example.com"
- end
- end
- end.new
-
- config.perform_caching = true
-
- assert_equal '/javascripts/vanilla.js'.length, 23
- assert_dom_equal(
- %(<script src="http://assets23.example.com/javascripts/vanilla.js"></script>),
- javascript_include_tag(:all, :cache => 'vanilla')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'vanilla.js'))
-
- class << @controller.request
- def protocol() 'https://' end
- def ssl?() true end
- end
-
- assert_equal '/javascripts/secure.js'.length, 22
- assert_dom_equal(
- %(<script src="https://localhost/javascripts/secure.js"></script>),
- javascript_include_tag(:all, :cache => 'secure')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'secure.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'vanilla.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'secure.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_and_using_subdirectory
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = 'http://a%d.example.com'
- config.perform_caching = true
-
- number = Zlib.crc32('/javascripts/cache/money.js') % 4
- assert_dom_equal(
- %(<script src="http://a#{number}.example.com/javascripts/cache/money.js"></script>),
- javascript_include_tag(:all, :cache => "cache/money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'cache', 'money.js'))
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'cache', 'money.js'))
- end
-
- def test_caching_javascript_include_tag_with_all_and_recursive_puts_defaults_at_the_start_of_the_file
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = 'http://a0.example.com'
- config.perform_caching = true
-
- assert_dom_equal(
- %(<script src="http://a0.example.com/javascripts/combined.js"></script>),
- javascript_include_tag(:all, :cache => "combined", :recursive => true)
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
-
- assert_equal(
- %(// prototype js\n\n// effects js\n\n// dragdrop js\n\n// controls js\n\n// bank js\n\n// robber js\n\n// subdir js\n\n\n// version.1.0 js\n\n// application js),
- IO.read(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
- )
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
- end
-
- def test_caching_javascript_include_tag_with_all_puts_defaults_at_the_start_of_the_file
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = 'http://a0.example.com'
- config.perform_caching = true
-
- assert_dom_equal(
- %(<script src="http://a0.example.com/javascripts/combined.js"></script>),
- javascript_include_tag(:all, :cache => "combined")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
-
- assert_equal(
- %(// prototype js\n\n// effects js\n\n// dragdrop js\n\n// controls js\n\n// bank js\n\n// robber js\n\n// version.1.0 js\n\n// application js),
- IO.read(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
- )
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'combined.js'))
- end
-
- def test_caching_javascript_include_tag_with_relative_url_root
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.relative_url_root = "/collaboration/hieraki"
- config.perform_caching = true
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/all.js"></script>),
- javascript_include_tag(:all, :cache => true)
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/money.js"></script>),
- javascript_include_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- # Same as above, but with script_name
- def test_caching_javascript_include_tag_with_script_name
- ENV["RAILS_ASSET_ID"] = ""
- @request.script_name = "/collaboration/hieraki"
- config.perform_caching = true
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/all.js"></script>),
- javascript_include_tag(:all, :cache => true)
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/money.js"></script>),
- javascript_include_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- def test_caching_javascript_include_tag_with_named_paths_and_relative_url_root_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.relative_url_root = "/collaboration/hieraki"
- config.perform_caching = false
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/robber.js"></script>),
- javascript_include_tag('robber', :cache => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/robber.js"></script>),
- javascript_include_tag('robber', :cache => "money", :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- # Same as above, but with script_name
- def test_caching_javascript_include_tag_with_named_paths_and_script_name_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- @request.script_name = "/collaboration/hieraki"
- config.perform_caching = false
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/robber.js"></script>),
- javascript_include_tag('robber', :cache => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="/collaboration/hieraki/javascripts/robber.js"></script>),
- javascript_include_tag('robber', :cache => "money", :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = false
-
- assert_dom_equal(
- %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- javascript_include_tag(:all, :cache => true)
- )
-
- assert_dom_equal(
- %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/subdir/subdir.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- javascript_include_tag(:all, :cache => true, :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_dom_equal(
- %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- javascript_include_tag(:all, :cache => "money")
- )
-
- assert_dom_equal(
- %(<script src="/javascripts/prototype.js"></script>\n<script src="/javascripts/effects.js"></script>\n<script src="/javascripts/dragdrop.js"></script>\n<script src="/javascripts/controls.js"></script>\n<script src="/javascripts/bank.js"></script>\n<script src="/javascripts/robber.js"></script>\n<script src="/javascripts/subdir/subdir.js"></script>\n<script src="/javascripts/version.1.0.js"></script>\n<script src="/javascripts/application.js"></script>),
- javascript_include_tag(:all, :cache => "money", :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_and_missing_javascript_file
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = true
-
- assert_raise(Errno::ENOENT) {
- javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => true)
- }
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_raise(Errno::ENOENT) {
- javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => "money")
- }
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_on_and_javascript_file_is_uri
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = true
-
- assert_raise(Errno::ENOENT) {
- javascript_include_tag('bank', 'robber', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.js', :cache => true)
- }
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
- end
-
- def test_caching_javascript_include_tag_when_caching_off_and_missing_javascript_file
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = false
-
- assert_raise(Errno::ENOENT) {
- javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => true)
- }
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
-
- assert_raise(Errno::ENOENT) {
- javascript_include_tag('bank', 'robber', 'missing_security_guard', :cache => "money")
- }
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
- end
-
- def test_caching_stylesheet_link_tag_when_caching_on
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = 'a0.example.com'
- config.perform_caching = true
-
- assert_dom_equal(
- %(<link href="http://a0.example.com/stylesheets/all.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => true)
- )
-
- files_to_be_joined = Dir["#{ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR}/[^all]*.css"]
-
- expected_mtime = files_to_be_joined.map { |p| File.mtime(p) }.max
- assert_equal expected_mtime, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- bytes_added_by_join = "\n\n".size * files_to_be_joined.size - "\n\n".size
- expected_size = files_to_be_joined.sum { |p| File.size(p) } + bytes_added_by_join
- assert_equal expected_size, File.size(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="http://a0.example.com/stylesheets/money.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
-
- assert_dom_equal(
- %(<link href="http://a0.example.com/absolute/test.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "/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_concat_stylesheet_link_tag_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
-
- assert_dom_equal(
- %(<link href="/stylesheets/all.css" media="screen" rel="stylesheet" />),
- 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" />),
- 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" />),
- 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_and_missing_css_file
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = true
-
- assert_raise(Errno::ENOENT) {
- stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => true)
- }
-
- assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_raise(Errno::ENOENT) {
- stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => "money")
- }
-
- assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.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'))
- end
-
- def test_caching_stylesheet_link_tag_when_caching_off_and_missing_css_file
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = false
-
- assert_raise(Errno::ENOENT) {
- stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => true)
- }
-
- assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_raise(Errno::ENOENT) {
- stylesheet_link_tag('bank', 'robber', 'missing_security_guard', :cache => "money")
- }
-
- assert ! File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.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'))
- end
-
- def test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.asset_host = Proc.new { |source| "a#{source.length}.example.com" }
- config.perform_caching = true
-
- assert_equal '/stylesheets/styles.css'.length, 23
- assert_dom_equal(
- %(<link href="http://a23.example.com/stylesheets/styles.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => 'styles')
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
-
- ensure
- FileUtils.rm_f(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
- end
-
- def test_caching_stylesheet_link_tag_with_relative_url_root
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.relative_url_root = "/collaboration/hieraki"
- config.perform_caching = true
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/all.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => true)
- )
-
- files_to_be_joined = Dir["#{ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR}/[^all]*.css"]
-
- expected_mtime = files_to_be_joined.map { |p| File.mtime(p) }.max
- assert_equal expected_mtime, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/money.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.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'))
- end
-
- # Same as above, but with script_name
- def test_caching_stylesheet_link_tag_with_script_name
- ENV["RAILS_ASSET_ID"] = ""
- @request.script_name = "/collaboration/hieraki"
- config.perform_caching = true
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/all.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => true)
- )
-
- files_to_be_joined = Dir["#{ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR}/[^all]*.css"]
-
- expected_mtime = files_to_be_joined.map { |p| File.mtime(p) }.max
- assert_equal expected_mtime, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/money.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "money")
- )
-
- assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.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'))
- end
-
-
- def test_caching_stylesheet_link_tag_with_named_paths_and_relative_url_root_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- @controller.config.relative_url_root = "/collaboration/hieraki"
- config.perform_caching = false
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/robber.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag('robber', :cache => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/robber.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag('robber', :cache => "money")
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
- end
-
- # Same as above, but with script_name
- def test_caching_stylesheet_link_tag_with_named_paths_and_script_name_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- @request.script_name = "/collaboration/hieraki"
- config.perform_caching = false
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/robber.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag('robber', :cache => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="/collaboration/hieraki/stylesheets/robber.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag('robber', :cache => "money")
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
- end
-
- def test_caching_stylesheet_include_tag_when_caching_off
- ENV["RAILS_ASSET_ID"] = ""
- config.perform_caching = false
-
- assert_dom_equal(
- %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => true)
- )
-
- assert_dom_equal(
- %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/subdir/subdir.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => true, :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
-
- assert_dom_equal(
- %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "money")
- )
-
- assert_dom_equal(
- %(<link href="/stylesheets/bank.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/robber.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/subdir/subdir.css" media="screen" rel="stylesheet" />\n<link href="/stylesheets/version.1.0.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag(:all, :cache => "money", :recursive => true)
- )
-
- assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
- end
-
- def test_caching_stylesheet_include_tag_with_absolute_uri
- ENV["RAILS_ASSET_ID"] = ""
-
- assert_dom_equal(
- %(<link href="/stylesheets/all.css" media="screen" rel="stylesheet" />),
- stylesheet_link_tag("/foo/baz", :cache => true)
- )
-
- FileUtils.rm(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
- end
end
class AssetTagHelperNonVhostTest < ActionView::TestCase
@@ -1336,8 +586,6 @@ class AssetTagHelperNonVhostTest < ActionView::TestCase
@request = Struct.new(:protocol).new("gopher://")
@controller.request = @request
-
- JavascriptIncludeTag.expansions.clear
end
def url_for(options)