[rspec-users] Validations are making me want to scream. help please

Michael magic6435 at gmail.com
Sat Jul 11 11:42:51 EDT 2009


Simply testing that my validations are working for a model called
Project.

MODEL
class Project < ActiveRecord::Base
  validates_presence_of :brief
end

SPEC
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Project do
  before(:each) do
    @project = Project.new(:title => "project title", :brief =>
"project brief")
  end

  it "should create a new instance given valid attributes" do
    @project.should be_valid
  end
end

ERROR
ActiveRecord::RecordInvalid in 'Project should create a new instance
given valid attributes'
Validation failed: Brief can't be blank


POST
How on earth can that be failing? its driving me nuts, i have a few
other tests that check the exact same way(method taken from the Rspec
book) so why all the sudden would it stop working on a new model. Blah
thanks for any help.


More information about the rspec-users mailing list