测试设计应用 [英] Testing devise with shoulda

查看:124
本文介绍了测试设计应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  2)错误:
test:handle :索引记录为admin应重定向到每日页面。
(Admin :: DailyClosesControllerTest):
NoMethodError:未定义的方法`env'为nil:NilClass
devise(1.0.6)[v] lib / devise / test_helpers.rb:52:in
`setup_controller_for_warden'

我的test_helper中有这个:

  include Devise :: TestHelpers 



提前感谢



Cristi

解决方案

code> include Devise :: TestHelpers 不会进入test_helper.rb文件,而是在单个测试类的范围内。就像他们的自述文件一样:

  class ActionController :: TestCase 
include Devise :: TestHelpers
end


I'm having some difficulties in testing devise with shoulda:

2) Error:
test: handle :index logged as admin should redirect to Daily page.
(Admin::DailyClosesControllerTest):
NoMethodError: undefined method `env' for nil:NilClass
devise (1.0.6) [v] lib/devise/test_helpers.rb:52:in
`setup_controller_for_warden'

I have this in my test_helper:

include Devise::TestHelpers

Thoughts ? Thanks in advance,

Cristi

解决方案

include Devise::TestHelpers doesn't go in the test_helper.rb file, but rather inside the scope of the individual testing classes. Just like their README shows:

class ActionController::TestCase
  include Devise::TestHelpers
end

这篇关于测试设计应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆