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
- require ‘test_helper’
- class LadderTest < ActiveSupport::TestCase
- def test_create_ladder_name_error
l = Ladder.create(:name => nil)
When I run rake test:units from the shell I get the following error
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.