[rspec-users] be_valid (validates_format_of ..., :on => :create)

Mark Wilden mark at mwilden.com
Mon Mar 2 12:12:14 EST 2009

On Mon, Mar 2, 2009 at 8:23 AM, Bart Zonneveld <zuperinfinite at gmail.com> wrote:
> On a second note, I noticed rspec default generated model specs now use
> Model.create!(@valid_attributes) as their default "all is valid" test.
> What's the advantage of this approach? I just write @model.attributes =
> @valid_attributes; @model.should be_valid, to prevent these specs to
> actually hit the db, and therefore speed up my specs a bit.

Wouldn't it be better to go through the complete create! cycle, to
make sure callbacks and database constraints (if any) are exercised?


More information about the rspec-users mailing list