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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:31:17+00:00 2026-05-11T22:31:17+00:00

The background: I’m having some problems with Thoughtbot’s Factory Girl gem, with is used

  • 0

The background: I’m having some problems with Thoughtbot’s “Factory Girl” gem, with is used to create objects to use in unit and other tests. I’d like to go to the console and run different Factory Girl calls to check out what’s happening. For example, I’d like to go in there are do…

>> Factory(:user).inspect

I know that you can run the console in different environments…

$ script/console RAILS_ENV=test

But when I do that, Factory class is not available. It looks as though test_helper.rb is not getting loaded.

I tried various require calls including one with the absolute path to test_helper.rb but they fail similarly to this:

$ script/console RAILS_ENV=test
>> require '/Users/ethan/project/contactdb/test/test_helper.rb'
  Errno::ENOENT: No such file or directory - 
  /Users/ethan/project/contactdb/config/environments/RAILS_ENV=test.rb

Grr. Argh.

  • 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-11T22:31:17+00:00Added an answer on May 11, 2026 at 10:31 pm

    For Rails < 3.0

    Run script/console --help. You’ll notice that the syntax is script/console [environment], which in your case is script/console test.

    I’m not sure if you have to require the test helper or if the test environment does that for you, but with that command you should at least be able to boot successfully into the test env.

    As a sidenote: It is indeed kind of odd that the various binaries in script/ has different ways of setting the rails environment.

    For Rails 3 and 4

    Run rails c test. Prepend bundle exec if you need this for the current app environment.

    For Rails 5 and 6

    Run rails console -e test.

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

Sidebar

Related Questions

Background: Our web app uses the jquery.constrain.js plugin to handle data entry in some
Background We need to develop a specialised CMS (internal use only) to support a
Background: I have a css and a js that is used only by the
Background We currently use OpenID for authentication of users, and use the Claimed Identity
Background: I have to create a report that will be run regularly to send
Background: I have a jQuery validation script, which is used on almost all my
Background: I have some existing apps in the App Store and I have just
Background Use Ajax to fire an event to the web server when a list
Background I've recently been a part of a project where twisted was used. We
Background: Some time ago, I built a system for recording and categorizing application crashes

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.