search for: have_valid_associ

Displaying 2 results from an estimated 2 matches for "have_valid_associ".

2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback. first, .should_have_valid_associations usage: context "A new Product" do specify "should have valid associations" do @product.should_have_valid_associations end end code: (thanks to Wilson/Defiler for converting to rspec) module Spec module Expectations module Should class Base de...
2007 Mar 29
21
a better "should have valid associations"
...ter test. rescue => err @failed_association = "#{assoc.name} // #{err}" end end !@failed_association end def failure_message "invalid association \"#{@failed_association}\" on #{@model_class}" end end def have_valid_associations HaveValidAssociations.new end end ======================================== Put this in your model spec. context "A new Page" do include ActiveRecordMatchers specify "should have valid associations" do object = Page.new object.should have_valid_associa...