I'm very new in Rails, and I have the following problem. I have this class  Url that has its own validations:
class Url
  validates :ipaddress, :format => {
    :with => Resolv::IPv4::Regex,
    :message => 'Deve ser um endereco IP valido'
  }
  validates :domain, :format => {
    :with => URI.regexp,
    :message => 'Deve ser um dominio valido'
  }
end
I have another class Link that has an Url. The validations are:
class Link
  validates :path, :format => {
    :with => /\A[\S]+\Z/,
    :message => 'Deve conter uma path valida'
  }
end
But the problem is when I run this test:
test 'test a link with a valid path' do
  link = Link.new()
  link.url = Url.new()
  link.path = 'this/is/my/favorite/path'
  assert_equal(true, link.valid?, 'Test a valid path')
end
The test says that everything is okay, but the validation of the URL is not occurring. How can I force Rails to validate the URL too?
 
    