Rob Biedenharn wrote: > On Dec 1, 2008, at 2:14 PM, Maulin Pathare wrote: >> >> >> When I run rake test:units from the shell I get the following error >> >> 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 am running rails version 2.2.2 >> >> Does anyone know whats wrong? Thanks. > > > Perhaps you need a line between 6 & 7 with: > > assert !l.valid? > > Otherwise the error object associated to the model will not have been > created. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > [EMAIL PROTECTED]
Hey, Thanks for the reply. The assert !l.valid? did not help. I still get the same error. When I run the command with the --trace command, I can see that rake fails right after the execute db:test:purge step. I have included 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:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (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.[] /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:341 /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:588:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:577:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke' /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:372 /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:588:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:577:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---