[rspec-users] rake spec default environment

Scott Taylor mailing_lists at railsnewbie.com
Tue Nov 20 12:00:47 EST 2007


On Nov 20, 2007, at 12:25 AM, Jonathan Linowes wrote:

> Hey scott,
> I'm running into this again
>
> What I'm trying to do is avoid 2 database.yml files -- one for my dev
> machine, one for the deploy server --
> by adding a new "staging" environment that is like "test" but on the
> server
> Since the server doesnt have a "development" env or db, the rake spec
> fails
> Is there a way to force the rake task to copy the schema from
> "production" rather than "development"?

Well, you could run the migrations with:

rake db:migrate RAILS_ENV="staging".

Check out capistrano to automate this stuff for you (and especially  
the excellent capistrano-ext gem for deploying to different  
environments).

Not sure why you would want to run your specs in another environment  
called staging - but, if you really want to, you should look into  
modifying spec_helper.rb to be less restrictive (currently it sets  
RAILS_ENV = "test").  FixtureReplacement (which I know you are  
using), also isn't being included, which is something I've been  
meaning to make configurable.  (Patches welcome, as always).

Scott





More information about the rspec-users mailing list