Forum: Ruby on Rails rake test_units not loading any fixtures

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bruce (Guest)
on 2006-01-02 06:42
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.
Derek H. (Guest)
on 2006-01-02 11:54
(Received via mailing list)
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
Manuel H. (Guest)
on 2006-01-05 14:39
(Received via mailing list)
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.
Jens-Christian F. (Guest)
on 2006-01-08 11:20
(Received via mailing list)
> 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
This topic is locked and can not be replied to.