Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3400328
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:52:46+00:00 2026-05-18T04:52:46+00:00

Hi I recently inherited a project in which the former dev was not familiar

  • 0

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.

class ApplicationController < ActionController::Base
  protect_from_forgery
  include SessionsHelper
  include BannersHelper
  include UsersHelper
  include EventsHelper
end

Specifically session management. This is okay and working with the app but I am having problems writing tests for this.

A specific example. Some of the actions do a before_filter to see if a current_user is an admin. This current_user is normally set by a sessions_helper method that is shared in all our controllers
So in order to properly test our controllers I need to be able to use this current_user method

I have tried this:

require 'test_helper'
require File.expand_path('../../../app/helpers/sessions_helper.rb', __FILE__)

class AppsControllerTest < 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 => @app.attributes
  end
end

The require statement finds the session_helper.rb okay but without the Rails magic it is not accessible in the same way with in the AppsControllerTest

How can I spoof this crazy setup to test?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:52:47+00:00Added an answer on May 18, 2026 at 4:52 am

    The only solution i found was to re-factor and use a decent auth plugin

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently inherited a project for the iPad which is basically an image/presentation viewer.
I recently inherited a project which I've cleaned up and finished. However, there is
I recently inherited a project where a sqlite db is stored on the users
I've recently inherited a web project from a workmate who left to join another
I recently inherited an iPhone app. The original developer did not understand memory management
I recently inherited an e-commerce app (Java/Struts) that I'm porting to Rails. The thing
My GUI project in Qt has a lot of configuration pages classes which all
I recently inherited a large software project written in Java. The last developer used
I’m looking for some advice. I recently wrapped up a project where I inherited
Our team has recently inherited code which is extremely disorganized. As a result, my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.