Sha256: 8f28162ad91835fa41dfbec3598af34690037401bc067f6b33337b3a4ef19459
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
require 'test/helper' class TestEightyFormat < Test::Unit::TestCase TEST_80 = 'test/test_data/wikipedia.80' TEST_80_GZ = 'test/test_data/wikipedia.80.gz' TEST_80_HTML = 'test/test_data/wikipedia-index.html' def test_parse_correct [ File.open(TEST_80), TEST_80, File.open(TEST_80_GZ), TEST_80_GZ ].each do |file_or_io| howmany = 0 file = EightyFormat.new(file_or_io).each do |entry| assert_equal("http://en.wikipedia.org/wiki/Main_Page", entry.url) assert_equal(File.open(TEST_80_HTML).read, entry.data) howmany += 1 break end assert_equal(1, howmany) end [ File.open(TEST_80), TEST_80, File.open(TEST_80_GZ), TEST_80_GZ ].each do |file_or_io| howmany = 0 EightyFormat.new(file_or_io).each do |entry| howmany += 1 end assert_equal(91, howmany) end end def test_dont_parse_incorrect assert_raises(EightyFormat::FileFormatError) do EightyFormat.new(TEST_80_HTML).each do # NOOP end end end end
Version data entries
5 entries across 5 versions & 1 rubygems