module Admin
  class ApplicationController < ActionController::Base

    if Rails.env.test?
      def current_user
        $mocked_user
      end
      helper_method :current_user
    end

    def index
    end
  end
end

module Admin
  class ApplicationController < ActionController::Base

    def current_user
      $mocked_user
    end
    helper_method :current_user

    def index
    end
  end
end

--- 
+++ 
@@ -1,10 +1,12 @@
 module Admin
   class ApplicationController < ActionController::Base
 
-    def current_user
-      $mocked_user
+    if Rails.env.test?
+      def current_user
+        $mocked_user
+      end
+      helper_method :current_user
     end
-    helper_method :current_user
 
     def index
     end
Save original requested path before redirecting to sign-in
