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.

2010/1/21 Me [email protected]:

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.[]

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:inexecute’
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:inexecute’
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:insynchronize’
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:ininvoke_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:ininvoke_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:insynchronize’
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:ininvoke’
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:inexecute’
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:inexecute’
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:insynchronize’
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:ininvoke_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:ininvoke_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:insynchronize’
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:ininvoke’
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:intop_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:intop_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:intop_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:instandard_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:inload’
F:/BACKUP/Backup/ruby/bin/rake:19

2010/1/21 Chris H. [email protected]:

** 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs