Browse files

add test checking that precompiling assets performs caching

  • Loading branch information...
1 parent 02691d3 commit 07c9ff0b4adc41ebcb1116e4ed8ad89f1445d95f @dmathieu dmathieu committed Jul 25, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 railties/test/application/assets_test.rb
View
12 railties/test/application/assets_test.rb
@@ -8,7 +8,7 @@ class AssetsTest < Test::Unit::TestCase
include Rack::Test::Methods
def setup
- build_app
+ build_app(:initializers => true)
boot_rails
end
@@ -61,6 +61,16 @@ def app
end
end
+ test "precompile properly performs caching" do
+ app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
+
+ capture(:stdout) do
+ Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
+ end
+ file = Dir["#{app_path}/public/assets/application-*.css"].first
+ assert_match /\/assets\/rails-([0-z]+)\.png/, 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; }"

0 comments on commit 07c9ff0

Please sign in to comment.