Hello,
I am a rails beginner and am having some trouble running the unit tests
using rake. i am following the example in the simply rails 2 book.

I have a simple model with one field "name" and a validation for name
that it cannot be empty

my test file looks like this


   1. require 'test_helper'
   2.
   3. class LadderTest < ActiveSupport::TestCase
   4.
   5.   def test_create_ladder_name_error
   6.     l = Ladder.create(:name => nil)
   7.     assert l.error.on(:name)
   8.   end
   9.
  10. end

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.
-- 
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to