PostgreSQL and unit tests


#1

After upgrading to 1.1, I can’t run any unit tests. Apparently when I
run rake test_units, it uses a migration to set up the database.
Unfortunately when it runs the migration, it’s adding not null
constraints to every field, even though I haven’t got that set up.
I’m using the ruby-postgres (0.7.1.2005.12.21) adapter with PostgreSQL
8.1.0.

I’m getting closer to switching over to MySQL, even though I prefer
PostgreSQL in general, as there are lots of little gotchas that get in
the way of development. I always question whether the rails code base
actually gets tested against postgres.

Pat


#2

On Sun, 2006-04-02 at 16:19 -0700, Pat M. wrote:

actually gets tested against postgres.


I’m using gem…

postgres (0.7.1)
The extension library to access a PostgreSQL database from Ruby.

rails (1.1.0, 1.0.0)
Web-application framework with template engine, control-flow layer,
and ORM.

rake (0.7.0, 0.6.2)
Ruby based make-like utility.

rpm -q postgresql

postgresql-7.4.8-1.RHEL4.1

and I just tested this and I didn’t have a problem with NOT NULL
migrations…they turned out just as defined.

Craig


#3

Pat M. wrote:

After upgrading to 1.1, I can’t run any unit tests. Apparently when I
run rake test_units, it uses a migration to set up the database.
Unfortunately when it runs the migration, it’s adding not null
constraints to every field, even though I haven’t got that set up.
I’m using the ruby-postgres (0.7.1.2005.12.21) adapter with PostgreSQL
8.1.0.

I’m getting closer to switching over to MySQL, even though I prefer
PostgreSQL in general, as there are lots of little gotchas that get in
the way of development. I always question whether the rails code base
actually gets tested against postgres.

Pat

Please try using ‘postgres’ gem instead of ‘ruby-postgres’ gem and let
us know what happens.

There are 3 different postgres drivers for Ruby, we should probably
bless one of them as the preferred driver for rails-1.1 and beyond.


#4

Use the latest release version of ruby-postgres, no the latest build.

I attempted to ‘update’ once before and ran into the same problem.


– Tom M.


#5

On Sun, 2006-04-02 at 22:52 -0700, Tom M. wrote:

Use the latest release version of ruby-postgres, no the latest build.

I attempted to ‘update’ once before and ran into the same problem.


I guess I was lucky to have chosen the postgres gem and thus was spared
but I have been having a problem now of new rows created in the
schema_info table rather than updating the 1 row. I do recall someone
asking about that in the past so I know it’s in the archives but if it’s
an easy answer, perhaps someone wants to save me the trouble of
searching the archives.

Craig


#6

On 4/2/06, John S. removed_email_address@domain.invalid wrote:

the way of development. I always question whether the rails code base

Posted via http://www.ruby-forum.com/.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Okay some of my gems were messed up so it took a while, but the tests
work using ‘postgres’ instead.

As for the three different drivers…it’s just really confusing, to
tell you the truth. Periodically I post to the list asking which one
to use, but there’s never a consensus it seems.

Thanks for the help.

Pat