fyi, I just posted this http://www.vaporbase.com/postings/Running_rspec_after_you_deploy - linoj
On Nov 20, 2007 2:55 PM, Jonathan Linowes <jonathan at parkerhill.com> wrote:> fyi, I just posted this > > http://www.vaporbase.com/postings/Running_rspec_after_you_deploy > > - linoj > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > 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:07 PM, Pat Maddox wrote:> On Nov 20, 2007 2:55 PM, Jonathan Linowes <jonathan at parkerhill.com> > wrote: >> fyi, I just posted this >> >> http://www.vaporbase.com/postings/Running_rspec_after_you_deploy >> >> - linoj >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersIt 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, at 8:36 PM, Jonathan Linowes wrote:> > On Nov 20, 2007, at 8:07 PM, Pat Maddox wrote: > >> On Nov 20, 2007 2:55 PM, Jonathan Linowes <jonathan at parkerhill.com> >> wrote: >>> fyi, I just posted this >>> >>> http://www.vaporbase.com/postings/Running_rspec_after_you_deploy >>> >>> - linoj >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> 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 >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> 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/spectypo: NOTE: this only occurs on rake spec...> > see thread http://rubyforge.org/pipermail/rspec-users/2007-October/ > 004206.html > > --linoj > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Nov 20, 2007 5:36 PM, Jonathan Linowes <jonathan at parkerhill.com> 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 :) Looks pretty cool. Though I''ll add that you should use cruisecontrol.rb so you know your specs are all passing before you deploy ;) Pat