Rspec for custom validations

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

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

I'd start by constructing an object that should pass the validation
and checking that some_object.should be_valid? and then by
constructing an object that isn't valid and checking that the object
isn't valid and that the right error message is present.

Fred