diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-29 20:57:53 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-29 20:57:53 +0000 |
commit | 91383e04265f41c3a8ae9411b05384b7ef2a36c1 (patch) | |
tree | 25721929570e07f35e318c3652dee7ac3e5fcb90 /actionpack/test | |
parent | 23fa0395d8d6b0365421b5dea9e5620b95c6b15c (diff) | |
download | rails-91383e04265f41c3a8ae9411b05384b7ef2a36c1.tar.gz rails-91383e04265f41c3a8ae9411b05384b7ef2a36c1.tar.bz2 rails-91383e04265f41c3a8ae9411b05384b7ef2a36c1.zip |
Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4098 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/fixtures/public/images/rails.png | bin | 0 -> 1787 bytes | |||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/public/images/rails.png b/actionpack/test/fixtures/public/images/rails.png Binary files differnew file mode 100644 index 0000000000..b8441f182e --- /dev/null +++ b/actionpack/test/fixtures/public/images/rails.png diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index bc7e3e0f7a..b3e062f4c8 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -27,6 +27,11 @@ class AssetTagHelperTest < Test::Unit::TestCase ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end + def teardown + Object.send(:remove_const, :RAILS_ROOT) if defined?(RAILS_ROOT) + ENV["RAILS_ASSET_ID"] = nil + end + AutoDiscoveryToTag = { %(auto_discovery_link_tag) => %(<link href="http://www.example.com" rel="alternate" title="RSS" type="application/rss+xml" />), %(auto_discovery_link_tag(:atom)) => %(<link href="http://www.example.com" rel="alternate" title="ATOM" type="application/atom+xml" />), @@ -115,6 +120,17 @@ class AssetTagHelperTest < Test::Unit::TestCase ImageLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + def test_timebased_asset_id + Object.send(:const_set, :RAILS_ROOT, File.dirname(__FILE__) + "/../fixtures/") + expected_time = File.stat(File.expand_path(File.dirname(__FILE__) + "/../fixtures/public/images/rails.png")).mtime.to_i.to_s + assert_equal %(<img alt="Rails" src="/images/rails.png?#{expected_time}" />), image_tag("rails.png") + end + + def test_preset_asset_id + Object.send(:const_set, :RAILS_ROOT, File.dirname(__FILE__) + "/../fixtures/") + ENV["RAILS_ASSET_ID"] = "4500" + assert_equal %(<img alt="Rails" src="/images/rails.png?4500" />), image_tag("rails.png") + end end class AssetTagHelperNonVhostTest < Test::Unit::TestCase |