Rake test_units not loading any fixtures


#1

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.


#2

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 wrote:

I am using PostgreSQL on Windows.
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Derek H.
HighGroove Studios - http://www.highgroove.com
Atlanta, GA
Keeping it Simple.
404.593.4879


#3

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:inpostgresql_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:inconnection_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:inretrieve_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:increate_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:insetup’

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.


#4

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-
on-rails-and-postgresql-schemas/

for this and some other fun with PostrgeSQL schematas

cu jc