[Rails] Unit tests broken out-of-the-box
Tim Bates
tim at bates.id.au
Wed Nov 10 05:33:27 GMT 2004
Tim Bates wrote:
> I'm using Postgres. The Rakefile that rails hands me calls dropdb and
> createdb to return the test database to a known state (ie empty) before
> it loads in db/production_structure.sql. This forces me to run the tests
> as a user with the authorisation to create new databases (ie postgres).
> I don't want to do this - I've created a test user, who owns the test
> database, and if that database gets dropped e doesn't have the
> permission to recreate it, and I want it to stay that way. Can the
> Rakefile be changed to not destroy the database every time I run the
> tests? This would seem to make sense for a commercial installation too -
> the users wouldn't need superuser privileges to the database to run
> their tests. I'm not sure how existing hosting installations handle this.
Actually, in an almost identical manner, I don't like the way the
`rails` command does an `rm -rf` on the folder name I specify - because
if means that to run `rails` on a directory, I have to have permissions
to the parent directory, which I may not have. Rather than destroying
the directory (or database), why can't Rails just remove everything in
it? This would allow the superuser to create the directory (or database)
and give permissions for it to a user, who can call `rails` on it (or
run tests on the database) without needing any more permissions than that.
Tim.
--
Tim Bates
tim at bates.id.au
More information about the Rails
mailing list