Reputation: 5558
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?
Upvotes: 0
Views: 499
Reputation: 5558
Stupid case. While moving the app from Rails2 to Rails3 I messed up database.yml, and my test db was set to devel. :)
Upvotes: 1
Reputation: 7533
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.
Upvotes: 1