gepub 0.6.9.1 → 0.6.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +4 -3
  6. data/gepub.gemspec +3 -3
  7. data/lib/gepub/book.rb +8 -7
  8. data/lib/gepub/version.rb +1 -1
  9. data/spec/bindings_spec.rb +6 -6
  10. data/spec/builder_spec.rb +106 -106
  11. data/spec/example_spec.rb +16 -7
  12. data/spec/fixtures/{epubcheck-3.0b4 → epubcheck-3.0.1}/COPYING.txt +19 -19
  13. data/spec/fixtures/{epubcheck-3.0b4 → epubcheck-3.0.1}/README.txt +50 -61
  14. data/spec/fixtures/epubcheck-3.0.1/THIRD-PARTY.txt +20 -0
  15. data/spec/fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar +0 -0
  16. data/spec/fixtures/epubcheck-3.0.1/lib/Saxon-HE-9.4.0.6.jar +0 -0
  17. data/spec/fixtures/epubcheck-3.0.1/lib/commons-compress-1.4.1.jar +0 -0
  18. data/spec/fixtures/epubcheck-3.0.1/lib/guava-13.0.1.jar +0 -0
  19. data/spec/fixtures/{epubcheck-3.0b4/lib/jing.jar → epubcheck-3.0.1/lib/jing-20120724.0.0.jar} +0 -0
  20. data/spec/fixtures/epubcheck-3.0.1/lib/sac-1.3.jar +0 -0
  21. data/spec/fixtures/epubcheck-3.0.1/licenses/Apache-2.0.txt +201 -0
  22. data/spec/fixtures/epubcheck-3.0.1/licenses/BSD-3-Clause.txt +27 -0
  23. data/spec/fixtures/epubcheck-3.0.1/licenses/MPL-1.0.txt +360 -0
  24. data/spec/fixtures/epubcheck-3.0.1/licenses/W3C.txt +16 -0
  25. data/spec/gepub_spec.rb +60 -47
  26. data/spec/manifest_spec.rb +9 -9
  27. data/spec/metadata_spec.rb +50 -50
  28. data/spec/package_spec.rb +29 -29
  29. data/spec/spec_helper.rb +19 -0
  30. data/spec/spine_spec.rb +14 -14
  31. metadata +46 -38
  32. data/spec/fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar +0 -0
  33. data/spec/fixtures/epubcheck-3.0b4/jing_license.txt +0 -12
  34. data/spec/fixtures/epubcheck-3.0b4/lib/commons-compress-1.2.jar +0 -0
  35. data/spec/fixtures/epubcheck-3.0b4/lib/cssparser-0.9.6.jar +0 -0
  36. data/spec/fixtures/epubcheck-3.0b4/lib/sac-1.3.jar +0 -0
  37. data/spec/fixtures/epubcheck-3.0b4/lib/saxon9he.jar +0 -0
@@ -10,14 +10,14 @@ describe GEPUB::Manifest do
10
10
  end
11
11
 
12
12
  it 'should be parsed' do
13
- @manifest.item_list.size.should == 9
14
- @manifest.item_list['ncx'].href.should == 'toc.ncx'
15
- @manifest.item_list['ncx'].media_type.should == 'application/x-dtbncx+xml'
16
- @manifest.item_list['cover'].href.should == 'cover/cover.xhtml'
17
- @manifest.item_list['cover'].media_type.should == 'application/xhtml+xml'
18
- @manifest.item_list['cover-image'].href.should == 'img/cover.jpg'
19
- @manifest.item_list['cover-image'].media_type.should == 'image/jpeg'
20
- @manifest.item_list['cover-image'].properties[0].should == 'cover-image'
13
+ expect(@manifest.item_list.size).to eq(9)
14
+ expect(@manifest.item_list['ncx'].href).to eq('toc.ncx')
15
+ expect(@manifest.item_list['ncx'].media_type).to eq('application/x-dtbncx+xml')
16
+ expect(@manifest.item_list['cover'].href).to eq('cover/cover.xhtml')
17
+ expect(@manifest.item_list['cover'].media_type).to eq('application/xhtml+xml')
18
+ expect(@manifest.item_list['cover-image'].href).to eq('img/cover.jpg')
19
+ expect(@manifest.item_list['cover-image'].media_type).to eq('image/jpeg')
20
+ expect(@manifest.item_list['cover-image'].properties[0]).to eq('cover-image')
21
21
  end
22
22
  end
23
23
  context 'generate new opf' do
@@ -30,7 +30,7 @@ describe GEPUB::Manifest do
30
30
  }
31
31
  }
32
32
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
33
- xml.xpath("//xmlns:item[@id='ncx' and @href='toc.ncx' and @media-type='application/x-dtbncx+xml']").size.should == 1
33
+ expect(xml.xpath("//xmlns:item[@id='ncx' and @href='toc.ncx' and @media-type='application/x-dtbncx+xml']").size).to eq(1)
34
34
  end
35
35
  end
36
36
  end
@@ -7,13 +7,13 @@ require 'nokogiri'
7
7
  describe GEPUB::Metadata do
8
8
  it 'should be initialized' do
9
9
  metadata = GEPUB::Metadata.new
10
- metadata.ns_prefix(GEPUB::XMLUtil::DC_NS).should == 'dc'
11
- metadata.ns_prefix(GEPUB::XMLUtil::OPF_NS).should be_nil
10
+ expect(metadata.ns_prefix(GEPUB::XMLUtil::DC_NS)).to eq('dc')
11
+ expect(metadata.ns_prefix(GEPUB::XMLUtil::OPF_NS)).to be_nil
12
12
  end
13
13
  it 'should be initialized with version 2.0' do
14
14
  metadata = GEPUB::Metadata.new('2.0')
15
- metadata.ns_prefix(GEPUB::XMLUtil::DC_NS).should == 'dc'
16
- metadata.ns_prefix(GEPUB::XMLUtil::OPF_NS).should == 'opf'
15
+ expect(metadata.ns_prefix(GEPUB::XMLUtil::DC_NS)).to eq('dc')
16
+ expect(metadata.ns_prefix(GEPUB::XMLUtil::OPF_NS)).to eq('opf')
17
17
  end
18
18
 
19
19
  context 'Parse Existing OPF' do
@@ -21,34 +21,34 @@ describe GEPUB::Metadata do
21
21
  @metadata = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test.opf'), '/package.opf').instance_eval{ @metadata }
22
22
  end
23
23
  it 'should parse title' do
24
- @metadata.main_title.should == 'TheTitle'
25
- @metadata.title_list.size.should == 2
26
- @metadata.title.to_s.should == 'TheTitle'
24
+ expect(@metadata.main_title).to eq('TheTitle')
25
+ expect(@metadata.title_list.size).to eq(2)
26
+ expect(@metadata.title.to_s).to eq('TheTitle')
27
27
  end
28
28
 
29
29
  it 'should parse main title with not first display-seq' do
30
30
  metadata = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test2.opf'), '/package.opf').instance_eval{ @metadata }
31
- metadata.title.to_s.should == 'TheTitle'
31
+ expect(metadata.title.to_s).to eq('TheTitle')
32
32
  end
33
33
 
34
34
  it 'should parse title-type' do
35
- @metadata.title_list[0].refiner_list('title-type').size.should == 1
36
- @metadata.title_list[0].refiner_list('title-type')[0].content.should == 'main'
37
- @metadata.title_list[1].refiner_list('title-type').size.should == 1
38
- @metadata.title_list[1].refiner_list('title-type')[0].content.should == 'collection'
35
+ expect(@metadata.title_list[0].refiner_list('title-type').size).to eq(1)
36
+ expect(@metadata.title_list[0].refiner_list('title-type')[0].content).to eq('main')
37
+ expect(@metadata.title_list[1].refiner_list('title-type').size).to eq(1)
38
+ expect(@metadata.title_list[1].refiner_list('title-type')[0].content).to eq('collection')
39
39
  end
40
40
 
41
41
  it 'should parse identifier' do
42
- @metadata.identifier_list.size.should == 2
43
- @metadata.identifier.to_s.should == 'urn:uuid:1234567890'
44
- @metadata.identifier_list[0].content.should == 'urn:uuid:1234567890'
45
- @metadata.identifier_list[0].refiner('identifier-type').to_s.should == 'uuid'
46
- @metadata.identifier_list[1].content.should == 'http://example.jp/epub/test/url'
47
- @metadata.identifier_list[1].refiner('identifier-type').to_s.should == 'uri'
42
+ expect(@metadata.identifier_list.size).to eq(2)
43
+ expect(@metadata.identifier.to_s).to eq('urn:uuid:1234567890')
44
+ expect(@metadata.identifier_list[0].content).to eq('urn:uuid:1234567890')
45
+ expect(@metadata.identifier_list[0].refiner('identifier-type').to_s).to eq('uuid')
46
+ expect(@metadata.identifier_list[1].content).to eq('http://example.jp/epub/test/url')
47
+ expect(@metadata.identifier_list[1].refiner('identifier-type').to_s).to eq('uri')
48
48
  end
49
49
 
50
50
  it 'should parse OPF2.0 meta node' do
51
- @metadata.oldstyle_meta.size.should == 1
51
+ expect(@metadata.oldstyle_meta.size).to eq(1)
52
52
  @metadata.oldstyle_meta[0].name == 'meta'
53
53
  @metadata.oldstyle_meta[0]['name'] == 'cover'
54
54
  @metadata.oldstyle_meta[0]['content'] == 'cover-image'
@@ -60,11 +60,11 @@ describe GEPUB::Metadata do
60
60
  @metadata = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/package_2_0.opf'), '/package.opf').instance_eval{ @metadata }
61
61
  end
62
62
  it 'should parse title' do
63
- @metadata.main_title.should == 'thetitle'
64
- @metadata.title_list.size.should == 1
63
+ expect(@metadata.main_title).to eq('thetitle')
64
+ expect(@metadata.title_list.size).to eq(1)
65
65
  end
66
66
  it 'should parse OPF2.0 meta node' do
67
- @metadata.oldstyle_meta.size.should == 1
67
+ expect(@metadata.oldstyle_meta.size).to eq(1)
68
68
  @metadata.oldstyle_meta[0].name == 'meta'
69
69
  @metadata.oldstyle_meta[0]['name'] == 'cover'
70
70
  @metadata.oldstyle_meta[0]['content'] == 'cover-image'
@@ -75,48 +75,48 @@ describe GEPUB::Metadata do
75
75
  it 'should write and read identifier' do
76
76
  metadata = GEPUB::Metadata.new
77
77
  metadata.add_identifier 'the_set_identifier', 'pub-id'
78
- metadata.identifier.to_s.should == 'the_set_identifier'
79
- metadata.identifier_list[0]['id'].should == 'pub-id'
78
+ expect(metadata.identifier.to_s).to eq('the_set_identifier')
79
+ expect(metadata.identifier_list[0]['id']).to eq('pub-id')
80
80
  end
81
81
 
82
82
  it 'should write and read identifier with identifier-type' do
83
83
  metadata = GEPUB::Metadata.new
84
84
  metadata.add_identifier 'http://example.jp/book/url', 'pub-id', 'uri'
85
- metadata.identifier.to_s.should == 'http://example.jp/book/url'
86
- metadata.identifier_list[0]['id'].should == 'pub-id'
87
- metadata.identifier_list[0].identifier_type.to_s.should == 'uri'
85
+ expect(metadata.identifier.to_s).to eq('http://example.jp/book/url')
86
+ expect(metadata.identifier_list[0]['id']).to eq('pub-id')
87
+ expect(metadata.identifier_list[0].identifier_type.to_s).to eq('uri')
88
88
  end
89
89
 
90
90
  it 'should write and read title' do
91
91
  metadata = GEPUB::Metadata.new
92
92
  metadata.add_title('The Main Title')
93
- metadata.title.to_s.should == 'The Main Title'
93
+ expect(metadata.title.to_s).to eq('The Main Title')
94
94
  end
95
95
 
96
96
  it 'should write and read title with type' do
97
97
  metadata = GEPUB::Metadata.new
98
98
  metadata.add_title('The Main Title', 'maintitle', GEPUB::TITLE_TYPE::MAIN)
99
- metadata.title.to_s.should == 'The Main Title'
100
- metadata.title.title_type.to_s.should == 'main'
99
+ expect(metadata.title.to_s).to eq('The Main Title')
100
+ expect(metadata.title.title_type.to_s).to eq('main')
101
101
  end
102
102
 
103
103
  it 'should write and read multipletitle with type' do
104
104
  metadata = GEPUB::Metadata.new
105
105
  metadata.add_title('The Main Title', 'maintitle', GEPUB::TITLE_TYPE::MAIN)
106
106
  metadata.add_title('The Book Series', 'series', GEPUB::TITLE_TYPE::COLLECTION).set_group_position(1)
107
- metadata.title.to_s.should == 'The Main Title'
108
- metadata.title.title_type.to_s.should == 'main'
107
+ expect(metadata.title.to_s).to eq('The Main Title')
108
+ expect(metadata.title.title_type.to_s).to eq('main')
109
109
 
110
- metadata.title_list[1].to_s.should == 'The Book Series'
111
- metadata.title_list[1].title_type.to_s.should == 'collection'
112
- metadata.title_list[1].group_position.to_s.should == '1'
110
+ expect(metadata.title_list[1].to_s).to eq('The Book Series')
111
+ expect(metadata.title_list[1].title_type.to_s).to eq('collection')
112
+ expect(metadata.title_list[1].group_position.to_s).to eq('1')
113
113
  end
114
114
 
115
115
  it 'should handle alternate-script metadata of creator, not using method chain' do
116
116
  metadata = GEPUB::Metadata.new
117
117
  metadata.add_creator('TheCreator', 'author', 'aut').set_display_seq(1).set_file_as('Creator, The').add_alternates({ 'ja-JP' => '作成者' })
118
- metadata.creator.to_s.should == 'TheCreator'
119
- metadata.creator.to_s('ja').should == '作成者'
118
+ expect(metadata.creator.to_s).to eq('TheCreator')
119
+ expect(metadata.creator.to_s('ja')).to eq('作成者')
120
120
  end
121
121
 
122
122
  it 'should handle alternate-script metadata of creator, not using method chain' do
@@ -126,14 +126,14 @@ describe GEPUB::Metadata do
126
126
  m.file_as = 'Creator, The'
127
127
  m.add_alternates({ 'ja-JP' => '作成者' })
128
128
 
129
- metadata.creator.to_s.should == 'TheCreator'
130
- metadata.creator.to_s('ja').should == '作成者'
129
+ expect(metadata.creator.to_s).to eq('TheCreator')
130
+ expect(metadata.creator.to_s('ja')).to eq('作成者')
131
131
  end
132
132
 
133
133
  it 'should detect duplicate id' do
134
134
  metadata = GEPUB::Metadata.new
135
135
  metadata.add_creator('TheCreator', 'id', 'aut')
136
- lambda { metadata.add_title('TheTitle', 'id') }.should raise_error(RuntimeError, "id 'id' is already in use.")
136
+ expect { metadata.add_title('TheTitle', 'id') }.to raise_error(RuntimeError, "id 'id' is already in use.")
137
137
  end
138
138
 
139
139
  it 'should generate empty metadata xml' do
@@ -144,20 +144,20 @@ describe GEPUB::Metadata do
144
144
  }
145
145
  }
146
146
  xml = Nokogiri::XML::Document.parse(builder.to_xml).at_xpath('//xmlns:metadata', { 'xmlns' => GEPUB::XMLUtil::OPF_NS})
147
- xml.namespaces['xmlns:dc'].should == GEPUB::XMLUtil::DC_NS
147
+ expect(xml.namespaces['xmlns:dc']).to eq(GEPUB::XMLUtil::DC_NS)
148
148
  end
149
149
 
150
150
  it 'should handle date with Time object' do
151
151
  metadata = GEPUB::Metadata.new
152
152
  a = Time.parse '2012-02-27 20:00:00 UTC'
153
153
  metadata.add_date(a, 'date')
154
- metadata.date.to_s.should == '2012-02-27T20:00:00Z'
154
+ expect(metadata.date.to_s).to eq('2012-02-27T20:00:00Z')
155
155
  end
156
156
 
157
157
  it 'should handle date with a not W3C-DTF string' do
158
158
  metadata = GEPUB::Metadata.new
159
159
  metadata.add_date('2012-02-28 05:00:00 +0900', 'date')
160
- metadata.date.to_s.should == '2012-02-27T20:00:00Z'
160
+ expect(metadata.date.to_s).to eq('2012-02-27T20:00:00Z')
161
161
  end
162
162
 
163
163
  it 'should generate metadata with id xml' do
@@ -168,7 +168,7 @@ describe GEPUB::Metadata do
168
168
  metadata.to_xml(xml)
169
169
  }
170
170
  }
171
- Nokogiri::XML::Document.parse(builder.to_xml).at_xpath('//dc:identifier', metadata.instance_eval {@namespaces}).content.should == 'the_uid'
171
+ expect(Nokogiri::XML::Document.parse(builder.to_xml).at_xpath('//dc:identifier', metadata.instance_eval {@namespaces}).content).to eq('the_uid')
172
172
  end
173
173
 
174
174
  it 'should generate metadata with creator refiner' do
@@ -181,12 +181,12 @@ describe GEPUB::Metadata do
181
181
  }
182
182
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
183
183
  ns = metadata.instance_eval { @namespaces }
184
- xml.at_xpath('//dc:creator', ns).content.should == 'TheCreator'
184
+ expect(xml.at_xpath('//dc:creator', ns).content).to eq('TheCreator')
185
185
  id = xml.at_xpath('//dc:creator', ns)['id']
186
- xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='role']").content.should == 'aut'
187
- xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='display-seq']").content.should == '1'
188
- xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='file-as']").content.should == 'Creator, The'
189
- xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='alternate-script' and @xml:lang='ja-JP']").content.should == '作成者'
186
+ expect(xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='role']").content).to eq('aut')
187
+ expect(xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='display-seq']").content).to eq('1')
188
+ expect(xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='file-as']").content).to eq('Creator, The')
189
+ expect(xml.at_xpath("//xmlns:meta[@refines='##{id}' and @property='alternate-script' and @xml:lang='ja-JP']").content).to eq('作成者')
190
190
  end
191
191
 
192
192
  it 'should generate metadata with old style meta tag' do
@@ -199,7 +199,7 @@ describe GEPUB::Metadata do
199
199
  }
200
200
  }
201
201
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
202
- xml.xpath("//xmlns:meta[@name='cover' and @content='cover.jpg']").size.should == 1
202
+ expect(xml.xpath("//xmlns:meta[@name='cover' and @content='cover.jpg']").size).to eq(1)
203
203
  end
204
204
  end
205
205
  end
@@ -6,31 +6,31 @@ require 'nokogiri'
6
6
  describe GEPUB::Package do
7
7
  it 'should be initialized' do
8
8
  opf = GEPUB::Package.new('/package.opf')
9
- opf.ns_prefix(GEPUB::XMLUtil::OPF_NS).should == 'xmlns'
9
+ expect(opf.ns_prefix(GEPUB::XMLUtil::OPF_NS)).to eq('xmlns')
10
10
  end
11
11
 
12
12
  context 'parse existing opf' do
13
13
  it 'should be initialized with opf' do
14
14
  opf = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test.opf'), '/package.opf')
15
- opf.ns_prefix(GEPUB::XMLUtil::OPF_NS).should == 'xmlns'
16
- opf['version'].should == '3.0'
17
- opf['unique-identifier'].should == 'pub-id'
18
- opf['xml:lang'].should == 'ja'
19
- opf['prefix'].should == 'foaf: http://xmlns.com/foaf/spec/ rendition: http://www.idpf.org/vocab/rendition/#'
15
+ expect(opf.ns_prefix(GEPUB::XMLUtil::OPF_NS)).to eq('xmlns')
16
+ expect(opf['version']).to eq('3.0')
17
+ expect(opf['unique-identifier']).to eq('pub-id')
18
+ expect(opf['xml:lang']).to eq('ja')
19
+ expect(opf['prefix']).to eq('foaf: http://xmlns.com/foaf/spec/ rendition: http://www.idpf.org/vocab/rendition/#')
20
20
  end
21
21
  it 'should parse prefix data' do
22
22
  package = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test.opf'), '/package.opf')
23
- package.prefixes.size.should == 2
24
- package.prefixes['foaf'].should == 'http://xmlns.com/foaf/spec/'
25
- package.prefixes['rendition'].should == 'http://www.idpf.org/vocab/rendition/#'
23
+ expect(package.prefixes.size).to eq(2)
24
+ expect(package.prefixes['foaf']).to eq('http://xmlns.com/foaf/spec/')
25
+ expect(package.prefixes['rendition']).to eq('http://www.idpf.org/vocab/rendition/#')
26
26
 
27
27
  end
28
28
 
29
29
  it 'should parse rendition metadata' do
30
30
  package = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test.opf'), '/package.opf')
31
- package.rendition_layout.should == 'pre-paginated'
32
- package.rendition_orientation.should == 'auto'
33
- package.rendition_spread.should == 'both'
31
+ expect(package.rendition_layout).to eq('pre-paginated')
32
+ expect(package.rendition_orientation).to eq('auto')
33
+ expect(package.rendition_spread).to eq('both')
34
34
 
35
35
  end
36
36
 
@@ -67,11 +67,11 @@ describe GEPUB::Package do
67
67
  }
68
68
  }
69
69
  xml = Nokogiri::XML::Document.parse opf.opf_xml
70
- xml.root.name.should == 'package'
71
- xml.root.namespaces.size.should == 1
72
- xml.root.namespaces['xmlns'].should == GEPUB::XMLUtil::OPF_NS
73
- xml.root['version'].should == '3.0'
74
- xml.root['xml:lang'].should == 'ja'
70
+ expect(xml.root.name).to eq('package')
71
+ expect(xml.root.namespaces.size).to eq(1)
72
+ expect(xml.root.namespaces['xmlns']).to eq(GEPUB::XMLUtil::OPF_NS)
73
+ expect(xml.root['version']).to eq('3.0')
74
+ expect(xml.root['xml:lang']).to eq('ja')
75
75
  # TODO: should check all elements
76
76
  end
77
77
 
@@ -83,7 +83,7 @@ describe GEPUB::Package do
83
83
  package.enable_rendition
84
84
  end
85
85
  xml = Nokogiri::XML::Document.parse package.opf_xml
86
- xml.root['prefix'].should == 'rendition: http://www.idpf.org/vocab/rendition/#'
86
+ expect(xml.root['prefix']).to eq('rendition: http://www.idpf.org/vocab/rendition/#')
87
87
  end
88
88
 
89
89
  it 'should generate package with rendition attributes' do
@@ -94,10 +94,10 @@ describe GEPUB::Package do
94
94
  package.rendition_spread = 'landscape'
95
95
  end
96
96
  xml = Nokogiri::XML::Document.parse package.opf_xml
97
- xml.root['prefix'].should == 'rendition: http://www.idpf.org/vocab/rendition/#'
98
- xml.at_xpath("//xmlns:meta[@property='rendition:layout']").content.should == 'pre-paginated'
99
- xml.at_xpath("//xmlns:meta[@property='rendition:orientation']").content.should == 'portlait'
100
- xml.at_xpath("//xmlns:meta[@property='rendition:spread']").content.should == 'landscape'
97
+ expect(xml.root['prefix']).to eq('rendition: http://www.idpf.org/vocab/rendition/#')
98
+ expect(xml.at_xpath("//xmlns:meta[@property='rendition:layout']").content).to eq('pre-paginated')
99
+ expect(xml.at_xpath("//xmlns:meta[@property='rendition:orientation']").content).to eq('portlait')
100
+ expect(xml.at_xpath("//xmlns:meta[@property='rendition:spread']").content).to eq('landscape')
101
101
  end
102
102
 
103
103
  it 'should handle ibooks version' do
@@ -106,8 +106,8 @@ describe GEPUB::Package do
106
106
  package.ibooks_version = '1.1.1'
107
107
  end
108
108
  xml = Nokogiri::XML::Document.parse package.opf_xml
109
- xml.root['prefix'].should == 'ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/'
110
- xml.at_xpath("//xmlns:meta[@property='ibooks:version']").content.should == '1.1.1'
109
+ expect(xml.root['prefix']).to eq('ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/')
110
+ expect(xml.at_xpath("//xmlns:meta[@property='ibooks:version']").content).to eq('1.1.1')
111
111
  end
112
112
 
113
113
  it 'should generate opf2.0' do
@@ -140,11 +140,11 @@ describe GEPUB::Package do
140
140
  }
141
141
  }
142
142
  xml = Nokogiri::XML::Document.parse opf.opf_xml
143
- xml.root.name.should == 'package'
144
- xml.root.namespaces.size.should == 1
145
- xml.root.namespaces['xmlns'].should == GEPUB::XMLUtil::OPF_NS
146
- xml.root['version'].should == '2.0'
147
- xml.root['xml:lang'].should == 'ja'
143
+ expect(xml.root.name).to eq('package')
144
+ expect(xml.root.namespaces.size).to eq(1)
145
+ expect(xml.root.namespaces['xmlns']).to eq(GEPUB::XMLUtil::OPF_NS)
146
+ expect(xml.root['version']).to eq('2.0')
147
+ expect(xml.root['xml:lang']).to eq('ja')
148
148
  end
149
149
  end
150
150
  end
@@ -1,3 +1,8 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require "stringio"
5
+
1
6
  begin
2
7
  require 'rspec'
3
8
  rescue LoadError
@@ -13,6 +18,20 @@ RSpec.configure do |config|
13
18
  config.tty = true
14
19
  # Use the specified formatter
15
20
  config.formatter = :documentation # :progress, :html, :textmate
21
+
22
+ def capture(stream)
23
+ begin
24
+ stream = stream.to_s
25
+ eval "$#{stream} = StringIO.new"
26
+ yield
27
+ result = eval("$#{stream}").string
28
+ ensure
29
+ eval "$#{stream} = #{stream.upcase}"
30
+ end
31
+ result
32
+ end
33
+
34
+
16
35
  end
17
36
 
18
37
  require 'rspec/core/formatters/base_text_formatter'
@@ -9,17 +9,17 @@ describe GEPUB::Spine do
9
9
  @spine = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test.opf'), '/package.opf').instance_eval{ @spine }
10
10
  end
11
11
  it 'should be parsed' do
12
- @spine.toc.should == 'ncx'
12
+ expect(@spine.toc).to eq('ncx')
13
13
  @spine.page_progression_direction == 'ltr'
14
- @spine.itemref_list.size.should == 4
15
- @spine.itemref_list[0].idref.should == 'cover'
16
- @spine.itemref_list[0].linear.should == 'no'
17
- @spine.itemref_list[1].idref.should == 'toc'
18
- @spine.itemref_list[1].linear.should == 'yes'
19
- @spine.itemref_list[2].idref.should == 'chap1'
20
- @spine.itemref_list[2].linear.should == 'yes'
21
- @spine.itemref_list[3].idref.should == 'nav'
22
- @spine.itemref_list[3].linear.should == 'no'
14
+ expect(@spine.itemref_list.size).to eq(4)
15
+ expect(@spine.itemref_list[0].idref).to eq('cover')
16
+ expect(@spine.itemref_list[0].linear).to eq('no')
17
+ expect(@spine.itemref_list[1].idref).to eq('toc')
18
+ expect(@spine.itemref_list[1].linear).to eq('yes')
19
+ expect(@spine.itemref_list[2].idref).to eq('chap1')
20
+ expect(@spine.itemref_list[2].linear).to eq('yes')
21
+ expect(@spine.itemref_list[3].idref).to eq('nav')
22
+ expect(@spine.itemref_list[3].linear).to eq('no')
23
23
  end
24
24
  end
25
25
  context 'generate new opf' do
@@ -33,8 +33,8 @@ describe GEPUB::Spine do
33
33
  }
34
34
  }
35
35
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
36
- xml.at_xpath('//xmlns:spine')['toc'].should == 'ncx'
37
- xml.xpath("//xmlns:itemref[@idref='the_id' and @linear='no']").size.should == 1
36
+ expect(xml.at_xpath('//xmlns:spine')['toc']).to eq('ncx')
37
+ expect(xml.xpath("//xmlns:itemref[@idref='the_id' and @linear='no']").size).to eq(1)
38
38
  end
39
39
  it 'should generate xml with property' do
40
40
  spine = GEPUB::Spine.new
@@ -46,8 +46,8 @@ describe GEPUB::Spine do
46
46
  }
47
47
  }
48
48
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
49
- xml.at_xpath('//xmlns:spine')['toc'].should == 'ncx'
50
- xml.xpath("//xmlns:itemref[@idref='the_id' and @properties='page-spread-right']").size.should == 1
49
+ expect(xml.at_xpath('//xmlns:spine')['toc']).to eq('ncx')
50
+ expect(xml.xpath("//xmlns:itemref[@idref='the_id' and @properties='page-spread-right']").size).to eq(1)
51
51
  end
52
52
 
53
53
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9.1
4
+ version: 0.6.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOJIMA Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
11
+ date: 2014-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.11'
19
+ version: '2.14'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.11'
26
+ version: '2.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.6
33
+ version: 1.6.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.5.6
40
+ version: 1.6.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubyzip
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.9.7
47
+ version: 1.1.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.9.7
54
+ version: 1.1.1
55
55
  description: gepub is a generic EPUB parser/generator. Generates and parse EPUB2 and
56
56
  EPUB3
57
57
  email:
@@ -62,9 +62,9 @@ executables:
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
- - .gitattributes
66
- - .gitignore
67
- - .travis.yml
65
+ - ".gitattributes"
66
+ - ".gitignore"
67
+ - ".travis.yml"
68
68
  - Gemfile
69
69
  - LICENSE.txt
70
70
  - README.md
@@ -104,15 +104,19 @@ files:
104
104
  - spec/fixtures/builder/text/localresource.conf
105
105
  - spec/fixtures/builder/text/memo.txt
106
106
  - spec/fixtures/builder/text/nav.xhtml
107
- - spec/fixtures/epubcheck-3.0b4/COPYING.txt
108
- - spec/fixtures/epubcheck-3.0b4/README.txt
109
- - spec/fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar
110
- - spec/fixtures/epubcheck-3.0b4/jing_license.txt
111
- - spec/fixtures/epubcheck-3.0b4/lib/commons-compress-1.2.jar
112
- - spec/fixtures/epubcheck-3.0b4/lib/cssparser-0.9.6.jar
113
- - spec/fixtures/epubcheck-3.0b4/lib/jing.jar
114
- - spec/fixtures/epubcheck-3.0b4/lib/sac-1.3.jar
115
- - spec/fixtures/epubcheck-3.0b4/lib/saxon9he.jar
107
+ - spec/fixtures/epubcheck-3.0.1/COPYING.txt
108
+ - spec/fixtures/epubcheck-3.0.1/README.txt
109
+ - spec/fixtures/epubcheck-3.0.1/THIRD-PARTY.txt
110
+ - spec/fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar
111
+ - spec/fixtures/epubcheck-3.0.1/lib/Saxon-HE-9.4.0.6.jar
112
+ - spec/fixtures/epubcheck-3.0.1/lib/commons-compress-1.4.1.jar
113
+ - spec/fixtures/epubcheck-3.0.1/lib/guava-13.0.1.jar
114
+ - spec/fixtures/epubcheck-3.0.1/lib/jing-20120724.0.0.jar
115
+ - spec/fixtures/epubcheck-3.0.1/lib/sac-1.3.jar
116
+ - spec/fixtures/epubcheck-3.0.1/licenses/Apache-2.0.txt
117
+ - spec/fixtures/epubcheck-3.0.1/licenses/BSD-3-Clause.txt
118
+ - spec/fixtures/epubcheck-3.0.1/licenses/MPL-1.0.txt
119
+ - spec/fixtures/epubcheck-3.0.1/licenses/W3C.txt
116
120
  - spec/fixtures/testdata/0.html
117
121
  - spec/fixtures/testdata/1.html
118
122
  - spec/fixtures/testdata/image1.jpg
@@ -136,17 +140,17 @@ require_paths:
136
140
  - lib
137
141
  required_ruby_version: !ruby/object:Gem::Requirement
138
142
  requirements:
139
- - - '>='
143
+ - - ">="
140
144
  - !ruby/object:Gem::Version
141
145
  version: '0'
142
146
  required_rubygems_version: !ruby/object:Gem::Requirement
143
147
  requirements:
144
- - - '>='
148
+ - - ">="
145
149
  - !ruby/object:Gem::Version
146
150
  version: '0'
147
151
  requirements: []
148
152
  rubyforge_project: gepub
149
- rubygems_version: 2.0.3
153
+ rubygems_version: 2.2.0
150
154
  signing_key:
151
155
  specification_version: 4
152
156
  summary: a generic EPUB library for Ruby.
@@ -162,15 +166,19 @@ test_files:
162
166
  - spec/fixtures/builder/text/localresource.conf
163
167
  - spec/fixtures/builder/text/memo.txt
164
168
  - spec/fixtures/builder/text/nav.xhtml
165
- - spec/fixtures/epubcheck-3.0b4/COPYING.txt
166
- - spec/fixtures/epubcheck-3.0b4/README.txt
167
- - spec/fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar
168
- - spec/fixtures/epubcheck-3.0b4/jing_license.txt
169
- - spec/fixtures/epubcheck-3.0b4/lib/commons-compress-1.2.jar
170
- - spec/fixtures/epubcheck-3.0b4/lib/cssparser-0.9.6.jar
171
- - spec/fixtures/epubcheck-3.0b4/lib/jing.jar
172
- - spec/fixtures/epubcheck-3.0b4/lib/sac-1.3.jar
173
- - spec/fixtures/epubcheck-3.0b4/lib/saxon9he.jar
169
+ - spec/fixtures/epubcheck-3.0.1/COPYING.txt
170
+ - spec/fixtures/epubcheck-3.0.1/README.txt
171
+ - spec/fixtures/epubcheck-3.0.1/THIRD-PARTY.txt
172
+ - spec/fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar
173
+ - spec/fixtures/epubcheck-3.0.1/lib/Saxon-HE-9.4.0.6.jar
174
+ - spec/fixtures/epubcheck-3.0.1/lib/commons-compress-1.4.1.jar
175
+ - spec/fixtures/epubcheck-3.0.1/lib/guava-13.0.1.jar
176
+ - spec/fixtures/epubcheck-3.0.1/lib/jing-20120724.0.0.jar
177
+ - spec/fixtures/epubcheck-3.0.1/lib/sac-1.3.jar
178
+ - spec/fixtures/epubcheck-3.0.1/licenses/Apache-2.0.txt
179
+ - spec/fixtures/epubcheck-3.0.1/licenses/BSD-3-Clause.txt
180
+ - spec/fixtures/epubcheck-3.0.1/licenses/MPL-1.0.txt
181
+ - spec/fixtures/epubcheck-3.0.1/licenses/W3C.txt
174
182
  - spec/fixtures/testdata/0.html
175
183
  - spec/fixtures/testdata/1.html
176
184
  - spec/fixtures/testdata/image1.jpg