undefined method `authenticate?'

by

If you are getting this error:

ActionView::Template::Error: undefined method `authenticate?' for nil:NilClass

in your call to Devise’s user_signed_in? or similar, you probably forgot to add this:

class ActionController::TestCase
  include Devise::TestHelpers
end

at the bottom of the test_helper.rb file. Not that that would ever happen to me…


4 responses to “undefined method `authenticate?'”

  1. Andrés Mejía Avatar

    You just saved me. Thanks.

  2. Sahil Verma Avatar

    Thank you! Apparently, Ruby class declarations are additive. The ActionController::TestCase class is declared in both the actionpack gem and your app’s test_helper.rb. However, both declarations are put together to form the class implementation as opposed to some languages where an error would occur at compile or interpretation time due to ambiguous redeclaration.

  3. urjit Avatar
    urjit

    Thank you man…
    gr8 answer.

  4. huska Avatar

    Thanks! It works

Leave a Reply

You may also like:

If you want to work with me or hire me? Contact me

You can follow me or connect with me:

Or get new content delivered directly to your inbox.

Join 5,043 other subscribers

I wrote a book:

Stack of copies of How to Hire and Manage Remote Teams

How to Hire and Manage Remote Teams, where I distill all the techniques I've been using to build and manage distributed teams for the past 10 years.

I write about:

announcement blogging book book review book reviews books building Sano Business C# Clojure ClojureScript Common Lisp database Debian Esperanto Git ham radio history idea Java Kubuntu Lisp management Non-Fiction OpenID programming Python Radio Society of Great Britain Rails rant re-frame release Ruby Ruby on Rails Sano science science fiction security self-help Star Trek technology Ubuntu web Windows WordPress

I've been writing for a while:

Mastodon

%d bloggers like this: