首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >所有Ruby测试都会引发: nil:NilClass的未定义方法‘`authenticate’

所有Ruby测试都会引发: nil:NilClass的未定义方法‘`authenticate’
EN

Stack Overflow用户
提问于 2010-11-30 05:05:29
回答 7查看 39.5K关注 0票数 132

我的大多数测试都提出了以下问题,我不明白为什么。所有方法调用都会引发“authenticate”错误。我检查了代码中是否有名为"authenticate“的方法,但没有这样的方法。

  1) Admin::CommentsController handling GET to index is successful
     Failure/Error: get :index
     undefined method `authenticate!' for nil:NilClass
     # ./spec/controllers/admin/comments_controller_spec.rb:9:in `block (3 levels) in <top (required)>'


  124) PostsController handling GET for a single post should render show template
     Failure/Error: get :show, :year => '2008', :month => '01', :day => '01', :slug => 'a-post'
     undefined method `authenticate' for nil:NilClass
     # ./app/controllers/application_controller.rb:18:in `set_current_user_for_model'
     # ./spec/controllers/posts_controller_spec.rb:131:in `do_get'
     # ./spec/controllers/posts_controller_spec.rb:140:in `block (3 levels) in <top (required)>'

这个项目可以在那里找到=> https://github.com/agilepandas/enki,如果你想自己运行测试的话。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4308094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档