how to use methods in application_controller in tests

Hi I have some protected methods in my application controller to handle
logging in users and Id like to be able to use them in my tests. But
whenever I try to run my tests i always get errors E.g.

NameError: undefined local variable or method `logged_in_user' for

how do i get round this. Heres some code -

class ApplicationController < ActionController::Base

  def logged_in_user?
    @logged_in_user = User.find(session[:user]) if session[:user]

  def logged_in_user=user
    if !user.nil?
      session[:user] = user
      @logged_in_user = user

  def logged_in_user
    if logged_in_user?
      return @logged_in_user

and my testfile

require 'test_helper'
require 'application_controller'

class DashboardControllerTest < ActionController::TestCase
  fixtures :users

  test "welcome page" do
    get :welcome
    assert_response :success

  test "logged in user can access dashboard" do
    assert logged_in_user, users(:valid_user)
    get :welcome
    assert_response :success

As the method is in another class the test case does not have access
to it. From looking at your test case it does not appear that you are
logging in a user. I would check out the test helpers in
restful_authentication[1] and use login_as for example. If you which
to test if a user is logged in then you will assert that that
@request.session[:user] is not nil. Personally I would not do this
assertion in this test as you are testing if a logged in user can
access the dashboard, not if a user is logged in.