我有一个使用rails 3.2.3和spork 1.0.0rc2的应用程序。 当我进行黄瓜测试时,我得到:
ActionView::Template::Error: undefined local variable or method `page_title'
在我的应用程序助手中定义了page_title。我不确定是什么打破了它们,因为它工作到最后一次捆绑更新。
任何人有同样的问题吗?
答案 0 :(得分:5)
要修复此问题,请在Spork.prefork块中添加以下这些行
full_names = Dir["#{Rails.root}/app/helpers/*.rb"]
full_names.collect do |full_name|
include Object.const_get(File.basename(full_name,'.rb').camelize)
end
答案 1 :(得分:2)
答案 2 :(得分:1)
使用spork时,人们一直在为rails 3.1报告类似内容:https://github.com/sporkrb/spork/issues/109
基本上,他们告诉你使用它:
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
我使用rails 3.1,但这并没有解决我的问题。我还在寻找答案。