views:

30

answers:

2

I am trying to get my hands on Rspec2 with Rails3 (never used rspec before). I have rspec-rails 2.0.0.beta20. After introducing some basic tests into spec/models and running

rspec spec/models/user_spec.rb

everthing is fine. However if I just run

rake spec

My development database is beeing wiped out. Even if I specify the environment explicitly

RAILS_ENV=test rake spec

My development database is beeing wiped to zero.

What I am doing wrong here? It feels like I am missing the concept for now. Anyone got any tips or could point me to some basic tutorial?

+1  A: 

Set the following sentence at the top of your spec_helper.rb file

ENV["RAILS_ENV"] ||= 'test'

This will ensure you use the right environment.

jpemberthy
I wrote in the original file, that I am setting the RAILS_ENV, and it doesn't help. Besides, my spec helper (http://gist.github.com/562539) contains this file.
mdrozdziel
A: 

Stupid case. While moving the app from Rails2 to Rails3 I messed up database.yml, and my test db was set to devel. :)

mdrozdziel