Skip to content

Commit

Permalink
Ensure that files that compile to js/css are not compiled by default …
Browse files Browse the repository at this point in the history
…with `rake assets:precompile`

This case was not tested and documentation was a bit confusing
on that topic, so it was not obvious if current code
works properly or not.
  • Loading branch information
drogus committed Dec 10, 2011
1 parent 1c2cb7d commit cde9981
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions railties/test/application/assets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def precompile!
end
end

test "precompile application.js and application.css and all other files not ending with .js or .css by default" do
test "precompile application.js and application.css and all other non JS/CSS files" do
app_file "app/assets/javascripts/application.js", "alert();"
app_file "app/assets/stylesheets/application.css", "body{}"

Expand All @@ -82,8 +82,11 @@ def precompile!
app_file "app/assets/javascripts/something.min.js", "alert();"
app_file "app/assets/stylesheets/something.min.css", "body{}"

app_file "app/assets/javascripts/something.else.js.erb", "alert();"
app_file "app/assets/stylesheets/something.else.css.erb", "body{}"

images_should_compile = ["a.png", "happyface.png", "happy_face.png", "happy.face.png",
"happy-face.png", "happy.happy_face.png", "happy_happy.face.png",
"happy-face.png", "happy.happy_face.png", "happy_happy.face.png",
"happy.happy.face.png", "happy", "happy.face", "-happyface",
"-happy.png", "-happy.face.png", "_happyface", "_happy.face.png",
"_happy.png"]
Expand All @@ -106,6 +109,9 @@ def precompile!

assert !File.exists?("#{app_path}/public/assets/something.min.js")
assert !File.exists?("#{app_path}/public/assets/something.min.css")

assert !File.exists?("#{app_path}/public/assets/something.else.js")
assert !File.exists?("#{app_path}/public/assets/something.else.css")
end

test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do
Expand Down

0 comments on commit cde9981

Please sign in to comment.