【问题标题】:RSpec Rails printing undefined home_path errorRSpec Rails 打印未定义的 home_path 错误
【发布时间】:2012-09-14 12:34:29
【问题描述】:

当我在我的 rails 项目上运行 rspec 时,我收到一条非常烦人的错误消息,尽管之前的代码完全相同。我唯一做的就是添加一个新的 rspec 文件。现在,新的 rspec 文件除了“require 'spec_helper'”之外什么都不包含,但我仍然收到此消息(以及其他一些消息......):

1) 主页应该有“列表”和“学生”链接 失败/错误:访问 home_path 名称错误: '

中未定义的局部变量或方法home_path' for > #<RSpec::Core::ExampleGroup::Nested_2:0x00000004c455a0> # ./spec/requests/homes_spec.rb:5:inblock(2 级)

我现在不知道该怎么办。有人知道这是怎么回事吗?

谢谢

【问题讨论】:

  • 请出示您的$ rake routes

标签: ruby-on-rails rspec undefined nameerror


【解决方案1】:

根据您的路线,适当的助手将是home_index_path。 尝试使用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-14
    相关资源
    最近更新 更多