[rspec-users] Validations aren't being performed when running 'rspec spec'
Tom Milewski
tmilewski at gmail.com
Wed Feb 23 10:29:50 EST 2011
Hello,
When I run 'rspec spec/models' everything runs beautifully.
When I run 'rspec spec/controllers' everything also runs beautifully.
When I run 'rspec spec' the models seem to forget that the records
need to pass the validations before being saved to the database.
This is consistent across all model tests which are checking
validations.
Model:
validates_presence_of :name, :location, :email...
Test:
it "should ensure that name is present" do
Factory.build(:public_agent, :name => nil).should
have(1).error_on(:name)
end
All of these tests do not return errors and do add the invalid records
to the database.
Has anyone else had this happen? Suggestions?
Thanks!
More information about the rspec-users
mailing list