shoulda_macros/units.rb
##
#  Asserts that model validates an associated model
#
#    should_validate_associated :foo, :bar
#
Asserts that model validates an associated model
should_validate_associated :foo, :bar
Asserts that model validates an associated model should_validate_associated : foo : bar
def should_validate_associated(*associations)
      klass = self.name.gsub(/Test$/, '').constantize
      associations.each do |association|
        should "validate associated #{association}" do
          assert klass.new.respond_to?("validate_associated_records_for_#{association}")
        end
      end
    end
def should_validate_associated ( * associations ) klass = self . name . gsub ( / Test$ / , '' ) . constantize associations . each do | association | should "validate associated #{association}" do assert klass . new . respond_to? ( "validate_associated_records_for_#{association}" ) end end end
Asserts that model validates an associated model
should_validate_associated :foo, :bar
Asserts that model validates an associated model should_validate_associated : foo : bar
associations