uncaught throw :warden in Devise Testing

后端 未结 2 1387
南笙
南笙 2020-12-30 23:54

I have just begun with testing Devise. I am unable to understand of why i am getting this error ::

Failure/Error: subject.current_user.should_not be_nil
 Ar         


        
相关标签:
2条回答
  • 2020-12-31 00:27

    uncaught throw :warden happens when authenticate_user! fails.

    Figure out why your the user's authentication is a failing, and you'll have solved your problem.

    0 讨论(0)
  • 2020-12-31 00:36

    I see this is a very old question, but I came across similar issue. This is what helped me.

    If you're using confirmable module, don't forget to confirm user, otherwise the Warden exception is thrown. Appropriate change to your code would be:

    before(:each) do
        user = Factory(:user)
        user.confirmed_at = Time.zone.now
        user.save
        @request.env["devise.mapping"] = Devise.mappings[:user]
        sign_in user
    end
    

    More info could be found in Devise Wiki

    0 讨论(0)
提交回复
热议问题