提交 f9a69e87 编写于 作者: S Santiago Pastorino 提交者: Xavier Noria

Merge pull request #2324 from zenapsis/3-1-stable

Rails 3.1 throws a Errno::ENOTDIR if files are put in assets directories
上级 05d4b9d2
......@@ -542,9 +542,9 @@ def load_seed
end
initializer :append_assets_path do |app|
app.config.assets.paths.unshift(*paths["vendor/assets"].existent)
app.config.assets.paths.unshift(*paths["lib/assets"].existent)
app.config.assets.paths.unshift(*paths["app/assets"].existent)
app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
end
initializer :prepend_helpers_path do |app|
......
......@@ -171,6 +171,10 @@ def expanded
def existent
expanded.select { |f| File.exists?(f) }
end
def existent_directories
expanded.select {|d| Dir.exists?(d) }
end
alias to_a expanded
end
......
......@@ -109,5 +109,19 @@ def index
assert_match "alert()", last_response.body
assert_equal nil, last_response.headers["Set-Cookie"]
end
test "files in any assets/ directories are not added to Sprockets" do
%w[app lib vendor].each do |dir|
app_file "#{dir}/assets/#{dir}_test.erb", "testing"
end
app_file "app/assets/javascripts/demo.js", "alert();"
require "#{app_path}/config/environment"
get "/assets/demo.js"
assert_match "alert();", last_response.body
assert_equal 200, last_response.status
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册