# Running tests against a non-test environment

**URL:** <https://www.ruby-forum.com/t/running-tests-against-a-non-test-environment/165404>\
**Category:** Rails\
**Created:** [April 13, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/running-tests-against-a-non-test-environment/165404 "2009-04-13T18:33:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [April 13, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/running-tests-against-a-non-test-environment/165404/1 "2009-04-13T18:33:14Z")

</div>

I am certain that running:

rake test RAILS\_ENV=\<some\_other\_env\_than\_test\>

should work, assuming that I have a correct DB setup in  
config/database.yml.

But this is not happening. It looks like rake test always is using the  
“test” DB no matter what.

If I type

rake test RAILS\_ENV=crap

or

RAILS\_ENV=crap; rake test

my tests will happily run and ignore the value of RAILS\_ENV that I’m  
trying to provide.

What gives? Did something change about running tests? Perhaps it’s  
always been this way and I never realized it.

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [April 13, 2009, 6:52pm UTC](https://www.ruby-forum.com/t/running-tests-against-a-non-test-environment/165404/2 "2009-04-13T18:52:24Z")

</div>

On Apr 13, 5:33 pm, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> my tests will happily run and ignore the value of RAILS\_ENV that I’m  
> trying to provide.
> 
> What gives? Did something change about running tests? Perhaps it’s  
> always been this way and I never realized it.

check the top of your app’s test\_helper.rb.

Fred

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [April 13, 2009, 8:32pm UTC](https://www.ruby-forum.com/t/running-tests-against-a-non-test-environment/165404/3 "2009-04-13T20:32:27Z")

</div>

> > 
> 
> check the top of your app’s test\_helper.rb.
> 
> Fred

Nicely done, sir. Many thanks.

W
