There is a validation error, which means you were trying to save the
object somewhere. Check both your tests and code, to find out where.
On Jul 11, 2009, at 10:42 AM, Michael wrote:
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.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users