When you test the helper in Rails, the helper is included in the test object. (The test object is an instance of ActionView :: TestCase.) Your helper method, user_is_admin? expects that there will also be a method called current_user . On controller and view_context objects, this method is provided by Devise, but it is not yet on your test object. Add it:
require 'test_helper' class ApplicationHelperTest < ActionView::TestCase def current_user users :default end test 'user is admin method' do assert user_is_admin? end end
The object returned by current_user is up to you. Here we returned the data. Here you can return any object that makes sense in the context of your test.
source share