# Rake Test / PostgreSQL database ownership

**URL:** <https://www.ruby-forum.com/t/rake-test-postgresql-database-ownership/172852>\
**Category:** Rails\
**Created:** [July 28, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/rake-test-postgresql-database-ownership/172852 "2009-07-28T23:44:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rilindo\_foster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rilindo\_foster](https://www.ruby-forum.com/u/rilindo_foster)\
**Post date:** [July 28, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/rake-test-postgresql-database-ownership/172852/1 "2009-07-28T23:44:27Z")

</div>

Hi Guys,

Is it normal for Rails to create and delete the test database during  
rake tests? It seems to be case when I started to run it.

Is there a way for the Rails not to create and delete databases during  
testing? I am little uncomfortable granting that much power to the  
rails user for testing - I would rather that it use the existing  
database and just delete/recreate tables instead.

- Rilindo

---

<div class="post-metadata">

**Author:** ![rilindo\_foster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rilindo\_foster](https://www.ruby-forum.com/u/rilindo_foster)\
**Post date:** [July 29, 2009, 7:00am UTC](https://www.ruby-forum.com/t/rake-test-postgresql-database-ownership/172852/2 "2009-07-29T07:00:26Z")

</div>

Testing is all about creating and destroying data. And you may learn  
soon that the best thing to do is to have a separate database for  
testing. Read the paragraph 2.1 of this page for a better  
understanding.

> **[Testing Rails Applications — Ruby on Rails Guides](https://guides.rubyonrails.org/testing.html#the-three-environments)**
>
> Testing Rails ApplicationsThis guide covers built-in mechanisms in Rails for testing your application.After reading this guide, you will know: Rails testing terminology. How to write unit, functional, integration, and system tests for your...

---

<div class="post-metadata">

**Author:** ![rilindo\_foster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rilindo\_foster](https://www.ruby-forum.com/u/rilindo_foster)\
**Post date:** [July 29, 2009, 11:56am UTC](https://www.ruby-forum.com/t/rake-test-postgresql-database-ownership/172852/3 "2009-07-29T11:56:01Z")

</div>

2009/7/28 rilindo foster [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 

In database.yml you can specify a different user for test and  
production. The production user can then just have whatever  
permissions he requires to run the app.

Colin
