How to set RAILS_ENV variable when running Rails tests?

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-05-18T20:13:51Z Indexed on 2010/05/23 1:20 UTC
Read the original article Hit count: 304

In both my environment.rb and test_helper.rb files I have:

ENV["RAILS_ENV"] = "development"

I have one functional test written, however when I run it, the script tries to connect to my database using the "test" configuration settings which are in the database.ymal file & won't connect the the database.

How can I run my tests using the "development" environment settings?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about testing