开发者

rake test and test_structure.sql

开发者 https://www.devze.com 2022-12-30 01:41 出处:网络
First of all, I have to run \"rake RAILS_ENV=test ...\" to get the test suites to hit my test DB. Annoying but ok to live with.

First of all, I have to run "rake RAILS_ENV=test ..." to get the test suites to hit my test DB. Annoying but ok to live with.

However when I do so, I get a long stream of errors like so:

> rake RAILS_ENV=test -I test test:units
psql:/path/to/project/db/test_structure.sql:33: ERROR:  function "armor" already exists with same argument types
[and many more]

It looks like some DB definitions are getting unnecessarily reloaded. I can't find any mention of this on Google, so I was wondering whether others have seen this?

I am using a PostgreSQL database with the following in my environment.rb:

  config.active_record.schema_format = :sq开发者_如何学JAVAl

and using Rails 2.3.5 with rake 0.8.7.

At this point I've fixed it but forgot how! I think I might have had pgcrypt loaded into the template schema, so the database was creating a "blank" database with it already loaded, and then rails was re-defining the functions from the saved schema. Unloading the functions from the template database would have fixed that.


The usual convention to run a rake task is as below:

> RAILS_ENV=test rake test:units

or as below:

> rake test:units RAILS_ENV=test

Can you try running in one of the above way? Hope that does the trick!

0

精彩评论

暂无评论...
验证码 换一张
取 消