在将Rails从4.2.9更新到4.2.10之后,Teaspoon损坏了。项目没有其他改变。
这是测试套件击中茶匙时的故障:
Starting the Teaspoon server...
[33337] Puma starting in cluster mode...
[33337] * Version 3.10.0 (ruby 2.3.3-p222), codename: Russell's Teapot
[33337] * Min threads: 5, max threads: 5
[33337] * Environment: test
[33337] * Process workers: 2
[33337] * Preloading application
[33337] * Listening on tcp://127.0.0.1:63120
[33337] Use Ctrl-C to stop
[33337] - Worker 0 (pid: 33351) booted, phase: 0
[33337] - Worker 1 (pid: 33352) booted, phase: 0
Teaspoon running default suite at http://127.0.0.1:63120/teaspoon/default
Error: ActionView::Template::Error: Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( support/bind-poly.self.js )` to `config/initializers/assets.rb` and restart your server
/Users/meltemi/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/helper.rb:363:in `raise_unless_precompiled_asset'
仅使用rake teaspoon
运行Teaspoon(而不是rake
是默认套件的default [:teaspoon]
),它的失败略有不同:
...
Teaspoon running default suite at http://127.0.0.1:63120/teaspoon/default
Failed to load: http://127.0.0.1:63120/teaspoon/default?reporter=Console
rake teaspoon failed
[33352] ! Detected parent died, dying
这是lib/sprockets/rails/helper.rb
上的那行跳闸:
def raise_unless_precompiled_asset(path)
raise Helper::AssetNotPrecompiled.new(path) if @check_precompiled_asset && !precompiled?(path)
end
Rails 4.2.9...4.2.10
之间的区别不大。希望你们中的一个更聪明的人能够发现可能引发这种情况的原因。似乎可能与资产管道或通往供应商的宝石的路线有关……但这只是一个猜测!
https://github.com/rails/rails/compare/v4.2.9...v4.2.10
答案 0 :(得分:1)
到目前为止,我对建议的猴子补丁here表示好运。
我将此添加到了taspoon_env.rb
文件的底部:
# https://github.com/modeset/teaspoon/issues/443
module RaiseUnlessPrecompiledFixer
def raise_unless_precompiled_asset(path)
super unless path.split('.')[-2] == 'self'
end
end
Sprockets::Rails::HelperAssetResolvers::Environment.send(:prepend,RaiseUnlessPrecompiledFixer)