test/test_publication.rb in epub-parser-0.1.6 vs test/test_publication.rb in epub-parser-0.1.7
- old
+ new
@@ -237,9 +237,19 @@
manifest = Package::Manifest.new
manifest << xhtml_item = Package::Manifest::Item.new.tap {|item| item.href = Addressable::URI.parse('text/01.xhtml')}
assert_nil xhtml_item.find_item_by_relative_iri(Addressable::URI.parse('../image/01.png'))
end
+
+ data('UTF-8' => [Encoding::UTF_8, 'utf-8-encoded'],
+ 'EUC-JP' => [Encoding::EUC_JP, 'euc-jp-encoded'],
+ 'Shift-JIS' => [Encoding::Shift_JIS, 'shift_jis-encoded'])
+ def test_read_detects_encoding_automatically(data)
+ encoding, id = data
+ epub = EPUB::Parser.parse('test/fixtures/book.epub')
+ item = epub.package.manifest[id]
+ assert_equal encoding, item.read.encoding
+ end
end
end
class TestSpine < TestPublication
class TestItemref < TestSpine