【问题标题】:Devise route helpers are not known during tests any more设计路线助手在测试期间不再为人所知
【发布时间】:2013-12-18 11:45:19
【问题描述】:

我的 devise 路由助手方法在我的 Ruby 功能测试中无法识别。

例如,我的应用程序布局包含对edit_admin_registration_path 的调用(因为我的设备型号是管理员),我收到以下错误:

ActionView::Template::Error: undefined local variable or method `edit_admin_registration_path' for #<#<Class:0x007ff332374038>:0x007ff330d54988>

运行时:

rake test:functionals TEST=test/functional/my_controller_test.rb 

我想我在升级到 Rails 3.2.15 后遇到了这个问题。知道为什么吗? (设计版本为 3.2.2)

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 devise ruby-on-rails-3.2


    【解决方案1】:
    1. 通过以下方式确保您拥有此路线助手:

      搜索路线

    2. 好像有类似的讨论Rails Can't find route in Functional Test

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-19
      • 2011-10-03
      相关资源
      最近更新 更多