Cap deploy:spec

fyi, I just posted this

http://www.vaporbase.com/postings/Running_rspec_after_you_deploy

  • linoj

On Nov 20, 2007 2:55 PM, Jonathan L. [email protected]
wrote:

fyi, I just posted this

http://www.vaporbase.com/postings/Running_rspec_after_you_deploy

  • linoj

rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

I’m kind of confused. You say that you’re not running the specs
against the production database, but it looks like that’s exactly
what’s going on. What am I missing?

Pat

On Nov 20, 2007, at 8:36 PM, Jonathan L. wrote:



specifies ENV[“RAILS_ENV”] = “test” to connect to the test one before
running the specs.

In my case the development: section in database.yml defines the one
on my development machine, so the spec fails when run on the server
with an error cannot connect to the database unless I say
RAILS_ENV=production

Not this only occurs on rake spec, not when running script/spec

typo: NOTE: this only occurs on rake spec…

On Nov 20, 2007, at 8:07 PM, Pat M. wrote:

http://rubyforge.org/mailman/listinfo/rspec-users
http://rubyforge.org/mailman/listinfo/rspec-users
It confused me too. I assume you’re referring to the rake spec command.
I’ve not followed the code, but what it does is connect to the
development database first (or production one if you say
RAILS_ENV=production) before getting to spec_helper which in turn
specifies ENV[“RAILS_ENV”] = “test” to connect to the test one before
running the specs.

In my case the development: section in database.yml defines the one
on my development machine, so the spec fails when run on the server
with an error cannot connect to the database unless I say
RAILS_ENV=production

Not this only occurs on rake spec, not when running script/spec

see thread http://rubyforge.org/pipermail/rspec-users/2007-October/
004206.html

–linoj

On Nov 20, 2007 5:36 PM, Jonathan L. [email protected]
wrote:

It confused me too. I assume you’re referring to the rake spec command.
I’ve not followed the code, but what it does is connect to the
development database first (or production one if you say
RAILS_ENV=production) before getting to spec_helper which in turn
specifies ENV[“RAILS_ENV”] = “test” to connect to the test one before
running the specs.

Okay, that makes sense. I was unaware that rake db:test:prepare
always used the test env as the target database to migrate. Seems
like it could be dangerous :slight_smile:

Looks pretty cool. Though I’ll add that you should use
cruisecontrol.rb so you know your specs are all passing before you
deploy :wink:

Pat