rails 3 + shoulda + validations based on callbacks -
i new shoulda. many of models have validations below
validates :sampling_method, :presence => true, :if => :type_of_resource validate :check_for_decimal_places, :if => :is_size_and_gdnt, :on => :update
here, type_of_resource , is_size_and_gdnt instance methods model
my shoulda validation first as
it { should validate_presence_of(:sampling_method) }
but dont know how add check if
i have checked second validation using creating object using factory girl, , checking values when object saved how test second validation using shoulda
Comments
Post a Comment