# Rake test\_units not loading any fixtures

**URL:** <https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517>\
**Category:** Rails\
**Created:** [January 2, 2006, 5:42am UTC](https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517 "2006-01-02T05:42:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@bruce](https://www.ruby-forum.com/u/bruce)\
**Post date:** [January 2, 2006, 5:42am UTC](https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517/1 "2006-01-02T05:42:05Z")

</div>

Hello All,

If I run my unit tests individually using Ruby, they all work correctly.

However, if I try to run them using “rake test\_units”, I get a bunch of  
error messages.

The error messages appear to be caused by rake not loading any of the  
fixtures into the test database.

I am using PostgreSQL on Windows.

Does anyone have any suggestions?

Many thanks,  
Bruce.

---

<div class="post-metadata">

**Author:** ![bruce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@bruce](https://www.ruby-forum.com/u/bruce)\
**Post date:** [January 2, 2006, 10:54am UTC](https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517/2 "2006-01-02T10:54:16Z")

</div>

Bruce,

Can you post the text of the error messages? I’ve seen something  
before, but I’d like to see what the actual output of your errors is.

- Derek

On 1/1/06, Bruce [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am using PostgreSQL on Windows.  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Derek H.  
HighGroove Studios - [http://www.highgroove.com](http://www.highgroove.com)  
Atlanta, GA  
Keeping it Simple.  
404.593.4879

---

<div class="post-metadata">

**Author:** ![bruce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@bruce](https://www.ruby-forum.com/u/bruce)\
**Post date:** [January 5, 2006, 1:39pm UTC](https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517/3 "2006-01-05T13:39:16Z")

</div>

Derek,

I’m using Postgres on Os X and get the same error. Seemingly an  
upgrade from 0.14.2 (or so) to 1.0 broke unit testing for me.

The relevant output from Rake:

(in /Some/Path/To/Project)  
createdb: database creation failed: ERROR: source database  
“template1” is being accessed by other users  
psql: FATAL: database “databasename\_test” does not exist  
/opt/local/bin/ruby -Ilib:test “/opt/local/lib/ruby/gems/1.8/gems/  
rake-0.6.2/lib/rake/rake\_test\_loader.rb” “test/unit/podcast\_test.rb”  
“test/unit/tag\_test.rb” “test/unit/weblog\_comment\_test.rb” “test/unit/  
weblog\_entry\_test.rb”  
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/  
rake\_test\_loader  
Started  
EEEEEEEE  
Finished in 0.141699 seconds.

1. Error:  
test\_truth(PodcastTest):  
PGError: FATAL: database “databasename\_test” does not exist

```
 /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/

```

active\_record/connection\_adapters/postgresql\_adapter.rb:24:in `connect' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/connection_adapters/postgresql_adapter.rb:24:in`postgresql\_connection’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/connection\_adapters/abstract/  
connection\_specification.rb:145:in `send' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/connection_adapters/abstract/ connection_specification.rb:145:in`connection\_without\_query\_cache=’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/query\_cache.rb:54:in `connection=' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/connection_adapters/abstract/ connection_specification.rb:106:in`retrieve\_connection’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/connection\_adapters/abstract/  
connection\_specification.rb:20:in `connection' /Users/manuel/Development/Rails/Podcast/Podcast/config/../vendor/ rails/activerecord/lib/active_record/fixtures.rb:242:in`create\_fixtures’  
/Users/manuel/Development/Rails/Podcast/Podcast/config/…/vendor/  
rails/activerecord/lib/active\_record/fixtures.rb:540:in `load_fixtures' /Users/manuel/Development/Rails/Podcast/Podcast/config/../vendor/ rails/activerecord/lib/active_record/fixtures.rb:487:in`setup’

I have setup the test database with the “postgres” user which has all  
permissions on my whole Postgres database server setup.

I’m a bit baffled by these errors…

Regards

Manuel H.

---

<div class="post-metadata">

**Author:** ![bruce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@bruce](https://www.ruby-forum.com/u/bruce)\
**Post date:** [January 8, 2006, 10:20am UTC](https://www.ruby-forum.com/t/rake-test-units-not-loading-any-fixtures/51517/4 "2006-01-08T10:20:37Z")

</div>

> I’m using Postgres on Os X and get the same error. Seemingly an  
> upgrade from 0.14.2 (or so) to 1.0 broke unit testing for me.
> 
> The relevant output from Rake:
> 
> (in /Some/Path/To/Project)  
> createdb: database creation failed: ERROR: source database  
> “template1” is being accessed by other users  
> […]
> 
> I’m a bit baffled by these errors…

I ran into the same problem and fixed it, by forcing “createdb” to  
use template0… See my post [http://blog.invisible.ch/2006/01/08/ruby-](http://blog.invisible.ch/2006/01/08/ruby-)  
on-rails-and-postgresql-schemas/

for this and some other fun with PostrgeSQL schematas

cu jc
