On Wed, Feb 23, 2011 at 10:29 AM, Tom Milewski <tmilew...@gmail.com> wrote:

> 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?


Though I'm still using RSpec 1, I do use FactoryGirl. Factory.build only
instantiates a new record; it does not save it. Thus, the example that you
shared should not create a record. Are you sure that the invalid records
that you're seeing in the database are from this example?

Regards,
Craig
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to