title: How to import Rails helpers in to the functional tests
body: <p>Hi I recently inherited a project in which the former dev was not familiar with rails, and decided to put a lot of important logic into the view helpers.</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery
    include SessionsHelper
    include BannersHelper
    include UsersHelper
    include EventsHelper
  end
  </code></pre>
  
  <p>Specifically session management. This is okay and working with the app but I am having problems writing tests for this. </p>
  
  <p>A specific example. Some of the actions do a <code>before_filter</code> to see if a <code>current_user</code> is an admin. This <code>current_user</code> is normally set by a <code>sessions_helper</code> method that is shared in all our controllers
  So in order to properly test our controllers I need to be able to use this <code>current_user</code> method</p>
  
  <p>I have tried this:</p>
  
  <pre><code>require 'test_helper'
  require File.expand_path('../../../app/helpers/sessions_helper.rb', __FILE__)
  
  class AppsControllerTest &lt; ActionController::TestCase
    setup do
      @app = apps(:one)
      current_user = users(:one)
    end
  
    test "should create app" do
      assert_difference('App.count') do
        post :create, :app =&gt; @app.attributes
    end
  end
  </code></pre>
  
  <p>The require statement finds the <code>session_helper.rb</code> okay but without the Rails magic it is not accessible in the same way with in the <code>AppsControllerTest</code></p>
  
  <p>How can I spoof this crazy setup to test?</p>