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

Chad Humphries chad at spicycode.com
Fri Mar 30 20:21:06 EDT 2007


josh,
sweet, missed your earlier post, looks like we've both finished these out :)

-chad

On 3/29/07, Josh Knowles <joshknowles at gmail.com> wrote:
>
>
> On 3/29/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> >
> >
> > How about this?
> >
> > project.should belong_to(:manager)
> > manager.should have_many(:projects)
> >
> > etc
> >
> > This would involve more matchers, but could be implemented in the same
> > fashion as have_association is above.
>
>
> I've implenented the first pass at the following rails matchers:
>
> should belong_to(association)
>  should have_many(association)
>  should validate_confirmation_of(attribute)
>  should validate_format_of(attribute, valid => [], invalid => [])
>  should validate_lendth_of(attribute, range)
>  should validate_presence_of(attribute)
>  should validate_uniqueness_of(attribute)
>
> Plugin available here:
> http://svn.integrumtech.com/public/plugins/rspec_on_rails_matchers/
>
> I haven't had a chance to get the README done, or any rdoc, but there are
> specs for the majority of the matchers.
>
> Comments / Suggestions Welcome!
>
> Josh
>
>
>
>
>  --
> Josh Knowles
> joshknowles at gmail.com
> http://joshknowles.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list