From 0e780e990bad30b0af0764b16833f35a1b89d72c Mon Sep 17 00:00:00 2001 From: kennyj Date: Fri, 13 Jan 2012 02:46:40 +0900 Subject: Fix GH #3980. Support assets:cache:clean method to respect sprockets cache. --- railties/test/application/assets_test.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'railties/test/application') diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 460c921ec3..01156e1b83 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -314,7 +314,7 @@ module ApplicationTests Dir.chdir(app_path){ `bundle exec rake assets:clean` } end - files = Dir["#{app_path}/public/assets/**/*", "#{app_path}/tmp/cache/*"] + files = Dir["#{app_path}/public/assets/**/*", "#{app_path}/tmp/cache/assets/*"] assert_equal 0, files.length, "Expected no assets, but found #{files.join(', ')}" end @@ -492,6 +492,18 @@ module ApplicationTests assert_match 'src="/sub/uri/assets/rails.png"', File.read("#{app_path}/public/assets/app.js") end + test "assets:cache:clean should clean cache" do + ENV["RAILS_ENV"] = "production" + precompile! + + quietly do + Dir.chdir(app_path){ `bundle exec rake assets:cache:clean` } + end + + require "#{app_path}/config/environment" + assert_equal 0, Dir.entries(Rails.application.assets.cache.cache_path).size - 2 # reject [".", ".."] + end + private def app_with_assets_in_view -- cgit v1.2.3