Permalink
Browse files

Merge pull request #1926 from tobsch/master

Accept application.js/.css to exist in a deeper directory depth by default
  • Loading branch information...
2 parents 2c72830 + 139971d commit 61913684a2be30190b49d4f8ac3314b3f2556273 @spastorino spastorino committed Jul 6, 2011
Showing with 8 additions and 5 deletions.
  1. +1 −1 railties/lib/rails/application/configuration.rb
  2. +7 −4 railties/test/application/assets_test.rb
@@ -34,7 +34,7 @@ def initialize(*)
@assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false
@assets.paths = []
- @assets.precompile = [ /\w+\.(?!js|css).+/, "application.js", "application.css" ]
+ @assets.precompile = [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
@assets.prefix = "/assets"
@assets.js_compressor = nil
@@ -37,14 +37,17 @@ def app
test "assets are compiled properly" do
app_file "app/assets/javascripts/application.js", "alert();"
+ app_file "app/assets/javascripts/foo/application.js", "alert();"
capture(:stdout) do
Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
end
-
- file = Dir["#{app_path}/public/assets/application-*.js"][0]
- assert_not_nil file, "Expected application.js asset to be generated, but none found"
- assert_equal "alert();\n", File.read(file)
+ files = Dir["#{app_path}/public/assets/application-*.js"]
+ files << Dir["#{app_path}/public/assets/foo/application-*.js"].first
+ files.each do |file|
+ assert_not_nil file, "Expected application.js asset to be generated, but none found"
+ assert_equal "alert();\n", File.read(file)
+ end
end
test "assets are cleaned up properly" do

0 comments on commit 6191368

Please sign in to comment.