Hi all, i am very new when it comes to writing tests, can anyone give
me an idea how to write RSpec test for the following custom
validation.


def validate_campaign_and_ad
    unless self.ad.nil? || self.ad.campaign_id == self.campaign_id
      errors.add(:campaign_id, "ad.campaign (#{self.ad.campaign_id})
does not match campaign (#{self.campaign_id})")
    end
  end


Thanks in Advance

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to