Regenerate gemspec for version 0.1.3

This commit is contained in:
magnolia-fan
2011-07-18 01:36:09 +04:00
parent 28b6001b0e
commit c0c41e9396
12 changed files with 249 additions and 14 deletions
+59
View File
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf8"?>
<FictionBook xmlns:l="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
<description>
<title-info>
<genre>fiction</genre>
<author>
<first-name>John</first-name>
<last-name>Doe</last-name>
</author>
<book-title>Fiction Book</book-title>
<annotation>
<p>Hello</p>
</annotation>
<keywords>john, doe, fiction</keywords>
<date value="2011-07-18">18.07.2011</date>
<coverpage></coverpage>
<lang>en</lang>
</title-info>
<document-info>
<author>
<first-name></first-name>
<last-name></last-name>
<nickname></nickname>
</author>
<program-used>Fb2 Gem</program-used>
<date value="2011-07-18">18.07.2011</date>
<src-url></src-url>
<src-ocr></src-ocr>
<id></id>
<version>1.0</version>
</document-info>
<publish-info>
</publish-info>
</description>
<body>
<title>
<p>John Doe</p>
<empty-line/>
<p>Fiction Book</p>
</title>
<section>
<title>
<p>Chapter 1</p>
</title>
<p>Line one of the first chapter</p>
<p>Line two of the first chapter</p>
<p>Line three of the first chapter</p>
</section>
<section>
<title>
<p>Chapter 2</p>
</title>
<p>Line one of the second chapter</p>
<p>Line two of the second chapter</p>
<p>Line three of the second chapter</p>
<p>Line four of the second chapter</p>
</section>
</body>
</FictionBook>
+45 -2
View File
@@ -1,7 +1,50 @@
require 'helper'
class TestFb2 < Test::Unit::TestCase
should "probably rename this file and start testing for real" do
flunk "hey buddy, you should probably rename this file and start testing for real"
context "parsing" do
setup do
@book = Fb2::parse(open('test/fixtures/sample.fb2'))
end
should "parse books" do
assert_instance_of(Book, @book)
end
should "load correct title" do
assert_equal('Fiction Book', @book.title)
end
should "load correct author" do
assert_equal('John Doe', [@book.author_first_name, @book.author_last_name].join(' '))
end
should "load correct annotation" do
assert_equal('Hello', @book.annotation)
end
should "load correct genre" do
assert_equal('fiction', @book.genre)
end
should "load correct language" do
assert_equal('en', @book.lang)
end
should "load correct keywords" do
assert_equal(['john', 'doe', 'fiction'], @book.keywords)
end
should "load all two chapters" do
assert_equal(2, @book.sections.length)
end
should "load correct second chapter's title" do
assert_equal('Chapter 2', @book.sections[1].title)
end
should "load all strings in each section" do
assert_equal(3, @book.sections[0].contents.length)
assert_equal(4, @book.sections[1].contents.length)
end
end
end