# -*- coding: utf-8 -*- require File.dirname(__FILE__) + '/spec_helper.rb' require 'rubygems' require 'nokogiri' describe GEPUB::Item do it "should return atttributes" do item = GEPUB::Item.new('theid', 'foo/bar.bar', 'application/xhtml+xml') item.itemid.should == 'theid' item.href.should == 'foo/bar.bar' item.mediatype.should == 'application/xhtml+xml' end it "should handle html" do item = GEPUB::Item.new('id', 'text/foo.html') item.mediatype.should == 'application/xhtml+xml' end it "should handle xhtml" do item = GEPUB::Item.new('id', 'text/foo.xhtml') item.mediatype.should == 'application/xhtml+xml' end it "should handle JPG" do item = GEPUB::Item.new('id', 'img/foo.JPG') item.mediatype.should == 'image/jpeg' end it "should handle css" do item = GEPUB::Item.new('id', 'img/foo.css') item.mediatype.should == 'text/css' end it "should handle javascript" do item = GEPUB::Item.new('id', 'js/jQuery.js') item.mediatype.should == 'text/javascript' end end describe GEPUB::Book do before do @book = GEPUB::Book.new('OEPBS/package.opf') @book.title = 'thetitle' @book.creator = "theauthor" @book.contributor = "contributors contributors!" @book.publisher = "thepublisher" @book.date = "2010-05-05" @book.identifier = "http://example.jp/foobar/" @book.language = 'ja' item1 = @book.add_item('text/foobar.xhtml',nil, 'c1') item1.add_content(StringIO.new('
the first page
')) @book.spine.push(item1) item2 = @book.add_ordered_item('text/barbar.xhtml', StringIO.new('second page, whith is test chapter.
'), 'c2') item2.toc_text 'test chapter' nav_string = <