RailsTutorial/require test_helper
RailsTutorial/require test_helper
我一直在关注 RailsTutorial.org 这本书(我在第 6 章)并且在 'localhost:3000' 上出现一个页面没有问题,能够编辑 html.erb 文件和 css 到我心中的内容......然后突然,我在终端中收到一个错误:
ActionController::RoutingError (undefined local variable or method test_helper' for main:Object):app/controllers/static_pages_controller.rb:1:in
'
以及 "We're sorry, but something went wrong." 在本地主机上。
我能做些什么来备份这个 运行?
您应该从文件 app/controllers/static_pages_controller.rb 中删除 require test_helper
。该行应该只用于您的测试,因为它是为测试设计的助手。特别是进入 tests/models/user_test.rb 文件,因为你在第 6 章。
我一直在关注 RailsTutorial.org 这本书(我在第 6 章)并且在 'localhost:3000' 上出现一个页面没有问题,能够编辑 html.erb 文件和 css 到我心中的内容......然后突然,我在终端中收到一个错误:
ActionController::RoutingError (undefined local variable or method
test_helper' for main:Object):app/controllers/static_pages_controller.rb:1:in
'
以及 "We're sorry, but something went wrong." 在本地主机上。
我能做些什么来备份这个 运行?
您应该从文件 app/controllers/static_pages_controller.rb 中删除 require test_helper
。该行应该只用于您的测试,因为它是为测试设计的助手。特别是进入 tests/models/user_test.rb 文件,因为你在第 6 章。