title: Test helper method with Minitest
body: <p>I would like to test a helper method using <strong>Minitest</strong> (<a href="https://rubygems.org/gems/minitest-rails" rel="nofollow noreferrer"><code>minitest-rails</code></a>) - but the helper method depends on <a href="https://github.com/plataformatec/devise#controller-filters-and-helpers" rel="nofollow noreferrer"><code>current_user</code>, a Devise helper method available to controllers and view</a>.</p>
  
  <p><strong>app/helpers/application_helper.rb</strong></p>
  
  <pre><code>def user_is_admin?                           # want to test
    current_user &amp;&amp; current_user.admin?
  end
  </code></pre>
  
  <p><strong>test/helpers/application_helper_test.rb</strong></p>
  
  <pre><code>require 'test_helper'
  
  class ApplicationHelperTest &lt; ActionView::TestCase
    test 'user is admin method' do
      assert user_is_admin?                # but current_user is undefined
    end
  end
  </code></pre>
  
  <p>Note that I am able to test other helper methods that do not rely on <code>current_user</code>.</p>