[rspec-users] a better "should have valid associations"

Chad Humphries chad at spicycode.com
Fri Mar 30 20:18:41 EDT 2007


I've been working on building out standard expectation matchers for
all the built-in validations in rails ala:

  setup do
     @user = User.new(valid_user_attributes)
   end

   specify do
     @user.should require_presence_of :first_name
   end

   specify do
     @user.should require_confirmation_of :password
   end

The first version has a few of the validators, the next release coming
shortly will finish out all the rest.

-chad

On 3/30/07, Courtenay <court3nay at gmail.com> wrote:
> On 3/30/07, Brandon Keepers <bkeepers at gmail.com> wrote:
> >
> > The only thing I don't like about this approach (and ones similar) is
> > that it only checks the declaration.  While that is important, I also
> > think specs need to check that the declaration actually works
> > (foreign key exists in database, model exists, etc.).
> >
>
> That's what my original post does.
>
>
> Court3nay
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list