4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

undefined method `authenticate!' for nil:NilClass?でテストが失敗する場合の対処方法

Posted at

Deviseを利用したアプリでRspecを実行した際に、

     NoMethodError:
       undefined method `authenticate!' for nil:NilClass

というエラーが発生した。

rails_helper.rbに以下を追記することで、対処できた。

  config.include Devise::TestHelpers, :type => :controller

##参考

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?