Sha256: 7a7fa6940b762f6fe22e29c5929983e7561ba4ed3fe51146d5ee9a99ae32fda9

Contents?: true

Size: 1.77 KB

Versions: 6

Compression:

Stored size: 1.77 KB

Contents

require File.expand_path('test_helper', File.dirname(__FILE__))

# 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
    skip("Pending, broken")
    r = @v.validate_uri('http://code.dunae.ca/w3c_validators/test/invalid_feed.xml')
    assert_errors r, 1
    assert_warnings r, 1
  end
 
  def test_validating_file
    skip("Pending, broken")
    file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_feed.xml')
    r = @v.validate_file(file_path)
    assert_errors r, 1
  end
 
  def test_validating_text
    skip("Pending, broken")
    fragment = <<-EOT
    <?xml version="1.0" encoding="utf-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
     <title>Example Feed</title>
     <subtitle>A subtitle.</subtitle>
     <link href="http://example.org/feed/" rel="self"/>
     <link href="http://example.org/"/>
     <updated>2003-12-13T18:30:02Z</updated>
     <author>
       <email>johndoe@example.com</email>
     </author>
     <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
     <entry>
       <title>Atom-Powered Robots Run Amok</title>
       <link href="http://example.org/2003/12/13/atom03"/>
       <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
       <updated>2003-12-13T18:30:02Z</updated>
       <summary>Some text.</summary>
     </entry>
    </feed>
    EOT

    r = @v.validate_text(fragment)
    assert_equal 1, r.errors.length
  end


  def test_validating_text_via_file
    skip("Pending, broken")
    file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_feed.xml')
    fh = File.new(file_path, 'r+')    
    r = @v.validate_file(fh)
    fh.close
    assert_errors r, 1
  end


 
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/w3c_validators-1.2/test/test_feed_validator.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/w3c_validators-1.2/test/test_feed_validator.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/w3c_validators-1.2/test/test_feed_validator.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/w3c_validators-1.2/test/test_feed_validator.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/w3c_validators-1.2/test/test_feed_validator.rb
w3c_validators-1.2 test/test_feed_validator.rb