[rspec-users] rake spec loads development environment

Seung ho C. lists at ruby-forum.com
Fri Nov 12 14:57:44 EST 2010


Mark Wilden wrote in post #816031:
> On Tue, Aug 19, 2008 at 2:35 PM, Jonathan Linowes
> <jonathan at parkerhill.com>wrote:
>
>>
>>    rake spec RAILS_ENV=production
>>
>> that way the db:test:prepare uses the production db rather than the
>> development one
>
>
> I know this thread is long dead but ... you must be joking.
>
> ///ark

I went though same experience today with my recently setup ruby 1.9, 
rails 3.0, and rspec 2. "$ rake spec" loaded development environment, 
hitting development db and pumping logs at log/development.log. This 
caused lot of confusion in my testing (As I run spec within RubyMine at 
the same time).

I found that there is "RAILS_ENV=development" in my bash environment. 
Once I remove that, everything works as expected. rspec loads test 
environment, test db, and logging at log/test.log.

One thing I noticed is when I have RAILS_ENV=development, even if I 
tried "$ rake spec RAILS_ENV=test", it actually hit development 
environment. I thought argument override shell env setting. Am I wrong 
or is it rspec issue?

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list