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 756719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:16:39+00:00 2026-05-14T15:16:39+00:00

Im getting the errors below despite following the documentation. In test_helper.rb ENV[RAILS_ENV] = test

  • 0

Im getting the errors below despite following the documentation.

In test_helper.rb

ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require "authlogic/test_case"
require 'test_help'
require 'shoulda'
require File.dirname(__FILE__) + "/factories"

In my functional test
require ‘test_helper’

class SentencesControllerTest < ActionController::TestCase
  setup do
    :activate_authlogic
  end

  context "logged in" do
    setup do
      @user = Factory(:user)
      UserSession.create(@user.id)
    end

    context "on GET to :new" do
      setup do
        get :new
      end

      should "present form with text field" do
        assert_select('form#new_sentence') do
          assert_select('textarea#sentence_text')
        end
      end
    end
  end #context logged in.
end

in environments.rb

  config.gem "authlogic"

Im not sure why it isnt working. Can anyone help out on this?

Authlogic::Session::Activation::NotActivatedError: You must activate the Authlogic::Session::Base.controller with a controller object before creating objects
authlogic (2.1.3) lib/authlogic/session/activation.rb:47:in `initialize'
    authlogic (2.1.3) lib/authlogic/session/klass.rb:64:in `initialize'
    authlogic (2.1.3) lib/authlogic/session/scopes.rb:79:in `initialize'
    authlogic (2.1.3) lib/authlogic/session/existence.rb:29:in `new'
    authlogic (2.1.3) lib/authlogic/session/existence.rb:29:in `create'
    test/functional/sentences_controller_test.rb:11:in `__bind_1270172858_922804'
    shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
    shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
    shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
    shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
    shoulda (2.10.3) lib/shoulda/context.rb:371:in `run_all_setup_blocks'
    shoulda (2.10.3) lib/shoulda/context.rb:375:in `run_parent_setup_blocks'
    shoulda (2.10.3) lib/shoulda/context.rb:359:in `test: logged in on GET to :new should present form with text field. '
    /opt/rubymine/rb/testing/patch/testunit/test/unit/ui/testrunnermediator.rb:36:in `run_suite'
    /opt/rubymine/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:215:in `start_mediator'
    /opt/rubymine/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:191:in `start'
  • 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-14T15:16:39+00:00Added an answer on May 14, 2026 at 3:16 pm

    Should:

    class SentencesControllerTest < ActionController::TestCase
    
      setup do
        :activate_authlogic
      end
    
      ...
    

    be:

    class SentencesControllerTest < ActionController::TestCase
    
      def setup              # setup should be its own method, prefixed with "def"
        activate_authlogic   # note the lack of a ":"
      end
    
      ...
    

    If, alternatively, you’re following the Rails testing tutorial, it may have a single-line setup deal like:

    setup :activate_authlogic  # note the USE of a ":" here - not sure why it's different between this and when you put it in its own method but that might be the answer for you
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.