aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-09-09 21:56:28 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-09-09 21:56:28 -0700
commitbe24be62b60c9cf6ca79aa7d20cabe6f3691e0c3 (patch)
tree1494570dd262026b7a521e5f24b0a8d0d561954a /railties/test/application
parentf43ffdcb9677d4fbe03ccd83a4c427b57ccd15f0 (diff)
parent901c02d86a1e2cccc8cc2c6ea9ec3f68a6c72607 (diff)
downloadrails-be24be62b60c9cf6ca79aa7d20cabe6f3691e0c3.tar.gz
rails-be24be62b60c9cf6ca79aa7d20cabe6f3691e0c3.tar.bz2
rails-be24be62b60c9cf6ca79aa7d20cabe6f3691e0c3.zip
Merge pull request #2876 from alex3/patch-1
Fixed assets precompile regex
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/assets_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index b9d8c002d7..b8a8665b3e 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -64,6 +64,34 @@ module ApplicationTests
end
end
+ test "precompile application.js and application.css and all other files not ending with .js or .css by default" do
+ app_file "app/assets/javascripts/application.js", "alert();"
+ app_file "app/assets/stylesheets/application.css", "body{}"
+ app_file "app/assets/javascripts/something.min.js", "alert();"
+ app_file "app/assets/stylesheets/something.min.css", "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.happy.face.png", "happy", "happy.face", "-happyface",
+ "-happy.png", "-happy.face.png", "_happyface", "_happy.face.png",
+ "_happy.png"]
+ images_should_compile.each do |filename|
+ app_file "app/assets/images/#{filename}", "happy"
+ end
+
+ capture(:stdout) do
+ Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
+ end
+
+ images_should_compile.each do |filename|
+ assert File.exists?("#{app_path}/public/assets/#{filename}")
+ end
+ assert File.exists?("#{app_path}/public/assets/application.js")
+ assert File.exists?("#{app_path}/public/assets/application.css")
+ assert !File.exists?("#{app_path}/public/assets/something.min.js")
+ assert !File.exists?("#{app_path}/public/assets/something.min.css")
+ end
+
test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do
add_to_config "config.assets.digest = true"
add_to_config "config.action_controller.perform_caching = false"