Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test for assets:clean task issue #3221

Merged
merged 2 commits into from
Oct 4, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion railties/test/application/assets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class ::PostsController < ActionController::Base ; end
end

test "digested assets are not mistakenly removed" do
app_file "public/assets/application.js", "alert();"
app_file "app/assets/application.js", "alert();"
add_to_config "config.assets.compile = true"
add_to_config "config.assets.digest = true"

Expand All @@ -438,6 +438,19 @@ class ::PostsController < ActionController::Base ; end
assert_equal 1, files.length, "Expected digested application.js asset to be generated, but none found"
end

test "digested assets are removed from configured path" do
app_file "public/production_assets/application.js", "alert();"
add_to_env_config "production", "config.assets.prefix = 'production_assets'"

ENV["RAILS_ENV"] = nil
quietly do
Dir.chdir(app_path){ `bundle exec rake assets:clean` }
end

files = Dir["#{app_path}/public/production_assets/application.js"]
assert_equal 0, files.length, "Expected application.js asset to be removed, but still exists"
end

private

def app_with_assets_in_view
Expand Down