Skip to content
This repository
Browse code

Fix assets tests in railties

  • Loading branch information...
commit 590239156714c03ad525b2248a11a3f34da3aa6a 1 parent 4dd985a
Jon Leighton authored August 16, 2011
4  actionpack/lib/sprockets/assets.rake
@@ -9,7 +9,9 @@ namespace :assets do
9 9
       Kernel.exec $0, *ARGV
10 10
     else
11 11
       Rake::Task["environment"].invoke
12  
-      Sprockets::Helpers::RailsHelper
  12
+
  13
+      # Ensure that action view is loaded and the appropriate sprockets hooks get executed
  14
+      ActionView::Base
13 15
 
14 16
       assets = Rails.application.config.assets.precompile
15 17
       # Always perform caching so that asset_path appends the timestamps to file references.
8  railties/test/application/assets_test.rb
@@ -54,8 +54,8 @@ def app
54 54
       capture(:stdout) do
55 55
         Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
56 56
       end
57  
-      files = Dir["#{app_path}/public/assets/application-b29a188b3d9c74ef7cbb7ddf9e99f953.js"]
58  
-      files << Dir["#{app_path}/public/assets/foo/application-b29a188b3d9c74ef7cbb7ddf9e99f953.js"].first
  57
+      files = Dir["#{app_path}/public/assets/application-*.js"]
  58
+      files << Dir["#{app_path}/public/assets/foo/application-*.js"].first
59 59
       files.each do |file|
60 60
         assert_not_nil file, "Expected application.js asset to be generated, but none found"
61 61
         assert_equal "alert()", File.read(file)
@@ -68,7 +68,7 @@ def app
68 68
       # capture(:stdout) do
69 69
         Dir.chdir(app_path){ `bundle exec rake assets:precompile RAILS_ENV=test` }
70 70
       # end
71  
-      file = Dir["#{app_path}/public/assets/application-4bd8b7059c5336ec7ad515c9dbd59974.css"].first
  71
+      file = Dir["#{app_path}/public/assets/application-*.css"].first
72 72
       assert_match /\/assets\/rails-([0-z]+)\.png/, File.read(file)
73 73
     end
74 74
 
@@ -79,7 +79,7 @@ def app
79 79
       capture(:stdout) do
80 80
         Dir.chdir(app_path){ `bundle exec rake assets:precompile RAILS_GROUPS=assets` }
81 81
       end
82  
-      file = Dir["#{app_path}/public/assets/application-8d301a938f1abfd789bbec87ed1ef770.css"].first
  82
+      file = Dir["#{app_path}/public/assets/application-*.css"].first
83 83
       assert_match /\/assets\/rails-([0-z]+)\.png/, File.read(file)
84 84
     end
85 85
 

0 notes on commit 5902391

Please sign in to comment.
Something went wrong with that request. Please try again.