Forum: Ruby on Rails Running tests against a non-test environment

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2009-04-13 18:33
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-04-13 18:52
(Received via mailing list)
On Apr 13, 5:33 pm, Wes Gamble <rails-mailing-l...@andreas-s.net>
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
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2009-04-13 20:32
>>
> check the top of your app's test_helper.rb.
>
> Fred

Nicely done, sir.  Many thanks.

W
This topic is locked and can not be replied to.