test:units failing

running rails 2.3, I do a rake test:units. No tests only default stuff. I get:

You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.

Any ideas? I have no real tests yet.

Show us the code that failed (around the line generating the error). But first look at it try and see why something that is expected to be one of your model objects is acutally nil.

Colin

No idea, here is the trace.

** Invoke test:units (first_time)

** Invoke db:test:prepare (first_time)

** Invoke db:abort_if_pending_migrations (first_time)

** Invoke environment (first_time)

** Execute environment

** Execute db:bort_if_pending_migrtions

** Execute db:test:prepre

** Invoke db:test:lod (first_time)

** Invoke db:test:purge (first_time)

** Invoke environment

** Execute db:test:purge

rake aborted!

You have a nil object when you didn’t expect it!

You might have expected an instance of ActiveRecord::Base.

The error occurred while evaluating nil.

F:/BACKUP/Backup/Web_apps_svn_working/writersonly/R2/vendor/rails/railties/lib/tasks/databases.rake:360

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke’

F:/BACKUP/Backup/Web_apps_svn_working/writersonly/R2/vendor/rails/railties/lib/tasks/databases.rake:391

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run’

F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31

F:/BACKUP/Backup/ruby/bin/rake:19:in `load’

F:/BACKUP/Backup/ruby/bin/rake:19

No idea, here is the trace. ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:bort_if_pending_migrtions ** Execute db:test:prepre ** Invoke db:test:lod (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge rake aborted! You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.

I presume you have created the test database? Otherwise I don't know, I assumed from your initial post that it was failing in your code but i see not.

Can anyone else help?

Colin