Topic: validates_presence_of not working during test using rspec

I am just starting out on Ruby and Rails (as a hobby) and playing around with testing before i get going on may first app.
So in my model file item_template.rb I have:

class ItemTemplate < ActiveRecord::Base
validates_presence_of :name
  attr_accessible :name, :description, :user_id
  belongs_to :user
  has_many :user_items
  has_many :memberships, :through => :user_items
end

if I go into the console and do
ItemTemplate.new().valid? 
I get false, while
ItemTemplate.new( :name => "blah").valid?
gives me a true, whichis what I expect.

but if I have the following in the test file item_template_spec.rb file
require File.dirname(__FILE__) + '/../spec_helper'

describe ItemTemplate do
  it "should have a name" do
    ItemTemplate.new().should_not be_valid
  end
end

after trying sever different ways of writing the test,  i think it just thinks ItemTemplate.new() is valid ... as a mater of fact
the following passes.
require File.dirname(__FILE__) + '/../spec_helper'

describe ItemTemplate do
  it "should have a name" do
    ItemTemplate.new().valid?
  end
end

I have been looking thru my setup but I don't see what I have wrong
Anyone have any idea's were to start?
There are a bunch of other tests that are included in some plugins that are working fine.

nPn

Re: validates_presence_of not working during test using rspec

I think I have convinced myself that the validations are not being run in the test env .. like I said above the validations seem to be working fine in the console,  anyone have any idea's on how to figure out what's going on with this?

Re: validates_presence_of not working during test using rspec

OK, I think I have a lead as to what is going on ... I used nify_scaffold to generate this and I was getting test fails for not having method any_instance which is in the mocha gem/plugin ...  I installed the gem but added  require 'mocha' at the end of spec_helper.rb rather than test_helper.rb ...
Once I fixed that, I get my validations working and no more missing any_instance errors, but now the restful authorization plugin is freaking out with all kinds of undefined method 'stub!' errors.
Any idea how to get pass those?

i uncommented out
config.mock_with :mocha
in spec_helper.rb
nPn