diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-21 10:00:31 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-21 10:00:31 -0700 |
commit | e369682ef1c405cab5cfa2f4066b7a0ca74a71fc (patch) | |
tree | 7eefb7fc58d2f7069a894d38c2fd508fa4d6760d | |
parent | 458512c8fa31196816dd2372fddecd0e0237c4c0 (diff) | |
parent | 7ca14ea39854407968a9264905a1965381a27c2a (diff) | |
download | rails-e369682ef1c405cab5cfa2f4066b7a0ca74a71fc.tar.gz rails-e369682ef1c405cab5cfa2f4066b7a0ca74a71fc.tar.bz2 rails-e369682ef1c405cab5cfa2f4066b7a0ca74a71fc.zip |
Merge pull request #1793 from jamesarosen/clean_images
rake assets:clean also removes directories
-rw-r--r-- | railties/lib/rails/tasks/assets.rake | 4 | ||||
-rw-r--r-- | railties/test/application/assets_test.rb | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/railties/lib/rails/tasks/assets.rake b/railties/lib/rails/tasks/assets.rake index ccd4d361bf..0236350576 100644 --- a/railties/lib/rails/tasks/assets.rake +++ b/railties/lib/rails/tasks/assets.rake @@ -19,8 +19,8 @@ namespace :assets do public_asset_path = Rails.public_path + assets.prefix file_list = FileList.new("#{public_asset_path}/**/*") file_list.each do |file| - rm file - rm "#{file}.gz", :force => true + rm_rf file + rm_rf "#{file}.gz" end end end diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index a93786becd..b76dae8e18 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -43,9 +43,23 @@ module ApplicationTests end file = Dir["#{app_path}/public/assets/application-*.js"][0] + assert_not_nil file, "Expected application.js asset to be generated, but none found" assert_equal "alert();\n", File.read(file) end + test "assets are cleaned up properly" do + app_file "public/assets/application.js", "alert();" + app_file "public/assets/application.css", "a { color: green; }" + app_file "public/assets/subdir/broken.png", "not really an image file" + + capture(:stdout) do + Dir.chdir(app_path){ `bundle exec rake assets:clean` } + end + + files = Dir["#{app_path}/public/assets/**/*"] + assert_equal 0, files.length, "Expected no assets, but found #{files.join(', ')}" + end + test "does not stream session cookies back" do app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();" |