Skip to content

Commit

Permalink
Merge pull request #2247 from dmathieu/test_precompile_caching
Browse files Browse the repository at this point in the history
Add test checking that precompiling assets performs caching
  • Loading branch information
josevalim committed Jul 25, 2011
2 parents a850cf7 + 07c9ff0 commit 451f63b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion railties/test/application/assets_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AssetsTest < Test::Unit::TestCase
include Rack::Test::Methods include Rack::Test::Methods


def setup def setup
build_app build_app(:initializers => true)
boot_rails boot_rails
end end


Expand Down Expand Up @@ -61,6 +61,16 @@ def app
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; }"
Expand Down

0 comments on commit 451f63b

Please sign in to comment.