ruby - How to run Rails console in the test environment and load test_helper.rb? -


Text after "itemprop =" text ">

Background: I, Thoughtbot's" Factory Girl "gem is having some problem with objects to use in I want to go to the unit and other tests I want to go to the console and look at various factory girl calls to see what's going on. For example, I want to go there ... ... < / P>

  & gt; Factory (: user) .inspect  

I know that you You can run the console in different environments ...

$ script / console RAILS_ENV = test

But when I do this, the factory class is not available. test_helper.rb is not loading.

I tried to do the different required one with absolute path of test_helper Including call .rb but they fail with it:

  $ script / console requires RAILS_ENV = test> gt; & gt; / Users / ethan / Project / contac Tdb / test / test_helper.rb 'errno :: ENOENT: Any such file or directory - /Users/ethan/project/contactdb/config/environments/RAILS_ENV=test.rb  

Grow Argh .

For Rails & lt; 3.0

play script / console --help . You will see that the syntax is script / console [environment] , which in your case is the script / console test .

I'm not sure whether you need to have a test assistant or have a test environment that is for you, but with that command you can at least boot to test env Must be enabled successfully if

form a sidenote:. This is actually a different way of establishing different binaries / rail environments in a way weird script.

For Rails 3 & 4

Run Rail C Test Bundle App If you need it for the current AP environment.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -