Sha256: 40648eac81933b7c330f9ef43ac8a093b9995c112317ae808818c4f290ce269e
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe Rpub::Epub::Toc do let(:chapters) { [] } let(:book) { double('book', :uid => 'foo', :title => 'title', :chapters => chapters) } let(:subject) { described_class.new(book).render } it { should have_xpath('/xmlns:ncx') } it { should have_xpath('/xmlns:ncx/xmlns:head/xmlns:meta[@name="dtb:uid"][@content="foo"]') } it { should have_xpath('/xmlns:ncx/xmlns:head/xmlns:meta[@name="dtb:depth"][@content="1"]') } it { should have_xpath('/xmlns:ncx/xmlns:head/xmlns:meta[@name="dtb:totalPageCount"][@content="0"]') } it { should have_xpath('/xmlns:ncx/xmlns:head/xmlns:meta[@name="dtb:maxPageNumber"][@content="0"]') } it { should have_xpath('/xmlns:ncx/xmlns:docTitle/xmlns:text[text()="title"]') } context 'without chapters' do it { should_not have_xpath('/xmlns:ncx/xmlns:navMap/xmlns:navPoint') } end context 'with chapters' do let(:chapters) { [double('chapter', :title => 'chapter title', :filename => 'filename', :xml_id => 'id')] } it { should have_xpath('/xmlns:ncx/xmlns:navMap/xmlns:navPoint[@id="id"]') } it { should have_xpath('/xmlns:ncx/xmlns:navMap/xmlns:navPoint/xmlns:navLabel/xmlns:text[text()="chapter title"]') } it { should have_xpath('/xmlns:ncx/xmlns:navMap/xmlns:navPoint/xmlns:content[@src="filename"]') } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rpub-0.3.0 | spec/rpub/epub/toc_spec.rb |
rpub-0.2.1 | spec/rpub/epub/toc_spec.rb |