[rspec-users] Problem running RSpec tests with Rails

David Chelimsky dchelimsky at gmail.com
Mon Jul 26 13:09:15 EDT 2010


On Jul 26, 2010, at 11:12 AM, Bruno Cardoso wrote:

> Hi
> 
> Not sure if this is a RSpec problem or Rails but I believe is more a
> RSpec situation.
> 
> What happens is that when I run my RSpecs tests all the BD is recreated,
> including the "schema_migration" table, because of this I get a problem
> saying:
> 
> You have 29 pending migrations:
>  20100628100855 CreateCustomers
>  20100628103228 CreateAccounts
>  20100628172155 CreateCfgEntities
>  ...
>  etc
> 
> It seems rails notices that the schema_migration tables is empty and
> that are migration scripts to run. This shouldn't be needed because
> Rails uses schema.rb to recreate the table, right?

The test database, yes, but it won't get that far if you have any pending migrations in the development database.

If you run "rake spec --trace" you'll see that it runs db:test:prepare, which runs db:abort_if_pending_migrations.

HTH,
David

> 
> I'm using JRuby with JDBC connection by the way.
> 
> Anyone know how to resolve this?




More information about the rspec-users mailing list