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

Josh Knowles joshknowles at gmail.com
Thu Mar 29 11:35:12 EDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070329/3da6ea13/attachment.html 


More information about the rspec-users mailing list