require File.dirname(__FILE__) + '/test_helper' # Test cases for the FeedValidator. class FeedValidatorTests < Test::Unit::TestCase include W3CValidators def setup @v = FeedValidator.new sleep 1 end def test_validating_uri_with_soap r = @v.validate_uri('http://code.dunae.ca/w3c_validators/test/invalid_feed.xml') assert_equal 1, r.errors.length assert_equal 1, r.warnings.length end def test_validating_file file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_feed.xml') r = @v.validate_file(file_path) assert_equal 1, r.errors.length end def test_validating_text fragment = <<-EOT Example Feed A subtitle. 2003-12-13T18:30:02Z johndoe@example.com urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6 Atom-Powered Robots Run Amok urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 2003-12-13T18:30:02Z Some text. EOT r = @v.validate_text(fragment) assert_equal 1, r.errors.length end end