1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #2247 from dmathieu/test_precompile_caching

Add test checking that precompiling assets performs caching
This commit is contained in:
José Valim 2011-07-25 05:36:00 -07:00
commit 451f63b42e

View file

@ -8,7 +8,7 @@ module ApplicationTests
include Rack::Test::Methods include Rack::Test::Methods
def setup def setup
build_app build_app(:initializers => true)
boot_rails boot_rails
end end
@ -61,6 +61,16 @@ module ApplicationTests
end end
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 test "assets are cleaned up properly" do
app_file "public/assets/application.js", "alert();" app_file "public/assets/application.js", "alert();"
app_file "public/assets/application.css", "a { color: green; }" app_file "public/assets/application.css", "a { color: green; }"