sandro/specjour

Potential issue with prepare

gerry3 opened this issue · 1 comments

Running specjour prepare causes Postgres to log errors that it can't find the databases, but it creates them (without tables). On a subsequent run, no errors are logged, but also no tables are created. We are running Rails 3.0.7 and RSpec 2.5.0 and Postgres.

After significant troubleshooting, I figured out that I needed to run rake spec once (I can abort with control-c) before I can run rspec directly (e.g. on a subset of our specs). Similarly, I need to run rake spec on each test database (assuming two cores) before specjour works:

rake spec TEST_ENV_NUMBER=1
control-c (after tests start)
rake spec TEST_ENV_NUMBER=2
control-c (after tests start)
specjour

Clearly, rake is running some important database setup tasks / code (we have custom code in the root level rails Rakefile and possibly other places).

I think I can run arbitrary code on each specjour test database by setting Specjour::Configuration.prepare in .specjour/hooks.rb, so if there's any rake tasks or other code that I need to run, it may work there.

parallel_tests seems to set up its databases correctly, but many of our specs fail.

I haven't used this on a Rails 3 project for some time, so I would appreciate any help you're willing to offer. The problem has to be in this file: https://github.com/sandro/specjour/blob/master/lib/specjour/db_scrub.rb. It sounds like the pending_migrations? method is no longer working.