gepub 0.6.9.1 → 0.6.9.2

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c4e620db16926b0183083e20ad92bcd94f378df
4
- data.tar.gz: 46cb5ee2b3d03a38c04f5f36f38f53b6e043f8cb
3
+ metadata.gz: 6790c94431137225f634825b8bb31fa4c17bf9fa
4
+ data.tar.gz: 6b8b2480b8892406e07f33a36563dc7448b20330
5
5
  SHA512:
6
- metadata.gz: 3613857a86e89772cb4139fa300cb33169ee3ff54184b16d634832b6910118f7b7addf921014ef2b15de7b370e0b60b7269bff322f4bc87e9302addc7e5f261f
7
- data.tar.gz: 0c7fac0b9106ab7fc405b15d9fc80a3f1bbc3633026e20d07ad613f4d97ec8668099053296089bbf7a69e20b72733fa0a8c761dc3f18f57820778882d22c5309
6
+ metadata.gz: 3f61337779cffc792a6d186fad5df3998437ec4a5f2785db9cce502af72c58d323037b63ccc0e102b9e9fe70514080056f35afe21a797646fd3d2c9a43c0d1b4
7
+ data.tar.gz: cffa739c71bbb81dddd083b03d5c2dedb4d203bd35d3f511cbdf96c1b288b70e30ab488462f38b9096a17b268d22ddb6af2f19c780cc04fa967f6899f78f960b
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.3
5
4
  - 2.0.0
5
+ - 2.1.0
6
6
  script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in gepub.gemspec
4
4
  gemspec
5
+ gem 'coveralls', require: false
@@ -2,7 +2,7 @@
2
2
 
3
3
  (The New BSD License)
4
4
 
5
- Copyright (c) 2010-2012, KOJIMA Satoshi
5
+ Copyright (c) 2010-2014, KOJIMA Satoshi
6
6
  All rights reserved.
7
7
 
8
8
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # gepub [<img src="https://secure.travis-ci.org/skoji/gepub.png" />](http://travis-ci.org/skoji/gepub)
1
+ # gepub
2
+ [<img src="https://secure.travis-ci.org/skoji/gepub.png" />](http://travis-ci.org/skoji/gepub) [![Coverage Status](https://coveralls.io/repos/skoji/gepub/badge.png?branch=master)](https://coveralls.io/r/skoji/gepub?branch=master)
2
3
 
3
4
  * http://en.skoji.jp/category/gepub/
4
5
 
@@ -8,9 +9,9 @@ a generic EPUB parser/generator library.
8
9
 
9
10
  ## FEATURES/PROBLEMS:
10
11
 
11
- * GEPUB::Book provides functionality to create EPUB file, and parsing EPUB file
12
+ * GEPUB::Book provides functionality to create EPUB file, and parsing EPUB files
12
13
  * Handle every metadata in EPUB2/EPUB3.
13
- * GEPUB::Builder privides easy and powerful way to create EPUB3 files
14
+ * GEPUB::Builder provides an easy and powerful way to create EPUB3 files
14
15
 
15
16
  * See [issues](https://github.com/skoji/gepub/issues/) for known problems.
16
17
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_development_dependency "rspec", "~> 2.11"
22
- s.add_runtime_dependency "nokogiri", "~> 1.5.6"
23
- s.add_runtime_dependency "rubyzip", "~> 0.9.7"
21
+ s.add_development_dependency "rspec", "~> 2.14"
22
+ s.add_runtime_dependency "nokogiri", "~> 1.6.1"
23
+ s.add_runtime_dependency "rubyzip", ">= 1.1.1"
24
24
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'rubygems'
3
3
  require 'nokogiri'
4
- require 'zip/zip'
4
+ require 'zip'
5
5
  require 'fileutils'
6
6
 
7
7
  # = GEPUB
@@ -102,15 +102,16 @@ module GEPUB
102
102
  files = {}
103
103
  package = nil
104
104
  package_path = nil
105
- Zip::ZipInputStream::open_buffer(io) {
105
+ book = nil
106
+ Zip::InputStream::open(io) {
106
107
  |zis|
107
108
  package, package_path = parse_container(zis, files)
108
109
  check_consistency_of_package(package, package_path)
109
110
  parse_files_into_package(files, package)
110
111
  book = Book.new(package.path)
111
112
  book.instance_eval { @package = package; @optional_files = files }
112
- book
113
113
  }
114
+ book
114
115
  end
115
116
 
116
117
  # creates new empty Book object.
@@ -213,7 +214,7 @@ module GEPUB
213
214
 
214
215
  # write EPUB to stream specified by the argument.
215
216
  def write_to_epub_container(epub)
216
- epub.put_next_entry('mimetype', '', '', Zip::ZipEntry::STORED)
217
+ epub.put_next_entry('mimetype', '', '', Zip::Entry::STORED)
217
218
  epub << "application/epub+zip"
218
219
 
219
220
  entries = {}
@@ -241,17 +242,17 @@ module GEPUB
241
242
  # generates and returns StringIO contains EPUB.
242
243
  def generate_epub_stream
243
244
  cleanup
244
- Zip::ZipOutputStream::write_buffer {
245
+ Zip::OutputStream::write_buffer(StringIO.new) do
245
246
  |epub|
246
247
  write_to_epub_container(epub)
247
- }
248
+ end
248
249
  end
249
250
 
250
251
  # writes EPUB to file. if file exists, it will be overwritten.
251
252
  def generate_epub(path_to_epub)
252
253
  cleanup
253
254
  File.delete(path_to_epub) if File.exist?(path_to_epub)
254
- Zip::ZipOutputStream::open(path_to_epub) {
255
+ Zip::OutputStream::open(path_to_epub) {
255
256
  |epub|
256
257
  write_to_epub_container(epub)
257
258
  }
@@ -1,4 +1,4 @@
1
1
  module GEPUB
2
2
  # GEPUB gem version
3
- VERSION = "0.6.9.1"
3
+ VERSION = "0.6.9.2"
4
4
  end
@@ -9,11 +9,11 @@ describe GEPUB::Bindings do
9
9
  @bindings = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/test_with_bindings.opf'), '/package.opf').instance_eval{ @bindings }
10
10
  end
11
11
  it 'should be parsed' do
12
- @bindings.media_types.size.should == 2
13
- @bindings.media_types[0].handler.should == 'h'
14
- @bindings.media_types[0].media_type.should == 'application/x-foreign-type'
15
- @bindings.media_types[1].handler.should == 'v'
16
- @bindings.media_types[1].media_type.should == 'application/x-other-foreign-type'
12
+ expect(@bindings.media_types.size).to eq(2)
13
+ expect(@bindings.media_types[0].handler).to eq('h')
14
+ expect(@bindings.media_types[0].media_type).to eq('application/x-foreign-type')
15
+ expect(@bindings.media_types[1].handler).to eq('v')
16
+ expect(@bindings.media_types[1].media_type).to eq('application/x-other-foreign-type')
17
17
  end
18
18
  end
19
19
 
@@ -27,7 +27,7 @@ describe GEPUB::Bindings do
27
27
  }
28
28
  }
29
29
  xml = Nokogiri::XML::Document.parse(builder.to_xml)
30
- xml.xpath("//xmlns:mediaType[@handler='id1' and @media-type='application/x-some-type']").size.should == 1
30
+ expect(xml.xpath("//xmlns:mediaType[@handler='id1' and @media-type='application/x-some-type']").size).to eq(1)
31
31
  end
32
32
  end
33
33
 
@@ -7,41 +7,41 @@ describe GEPUB::Builder do
7
7
  builder = GEPUB::Builder.new {
8
8
  language 'ja'
9
9
  }
10
- builder.instance_eval { @book.language }.to_s.should == 'ja'
10
+ expect(builder.instance_eval { @book.language }.to_s).to eq('ja')
11
11
  end
12
12
 
13
13
  it 'should generate uid' do
14
14
  builder = GEPUB::Builder.new {
15
15
  unique_identifier 'http://example.jp/as_url', 'BookID', 'url'
16
16
  }
17
- builder.instance_eval { @book.identifier }.to_s.should == 'http://example.jp/as_url'
18
- builder.instance_eval { @book.identifier_list[0]['id']}.should == 'BookID'
19
- builder.instance_eval { @book.identifier_list[0].identifier_type}.to_s.should == 'url'
17
+ expect(builder.instance_eval { @book.identifier }.to_s).to eq('http://example.jp/as_url')
18
+ expect(builder.instance_eval { @book.identifier_list[0]['id']}).to eq('BookID')
19
+ expect(builder.instance_eval { @book.identifier_list[0].identifier_type}.to_s).to eq('url')
20
20
  end
21
21
 
22
22
  it 'should generate title' do
23
23
  builder = GEPUB::Builder.new {
24
24
  title 'The Book Title'
25
25
  }
26
- builder.instance_eval { @book.title }.to_s.should == 'The Book Title'
27
- builder.instance_eval { @book.title.title_type }.to_s.should == 'main'
26
+ expect(builder.instance_eval { @book.title }.to_s).to eq('The Book Title')
27
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('main')
28
28
  end
29
29
 
30
30
  it 'should generate title with type ' do
31
31
  builder = GEPUB::Builder.new {
32
32
  subtitle 'the sub-title'
33
33
  }
34
- builder.instance_eval { @book.title }.to_s.should == 'the sub-title'
35
- builder.instance_eval { @book.title.title_type }.to_s.should == 'subtitle'
34
+ expect(builder.instance_eval { @book.title }.to_s).to eq('the sub-title')
35
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('subtitle')
36
36
  end
37
37
 
38
38
  it 'should generate collection title ' do
39
39
  builder = GEPUB::Builder.new {
40
40
  collection 'the collection', 3
41
41
  }
42
- builder.instance_eval { @book.title }.to_s.should == 'the collection'
43
- builder.instance_eval { @book.title.title_type }.to_s.should == 'collection'
44
- builder.instance_eval { @book.title.group_position }.to_s.should == '3'
42
+ expect(builder.instance_eval { @book.title }.to_s).to eq('the collection')
43
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('collection')
44
+ expect(builder.instance_eval { @book.title.group_position }.to_s).to eq('3')
45
45
  end
46
46
 
47
47
  it 'should refine title: alternates ' do
@@ -49,9 +49,9 @@ describe GEPUB::Builder do
49
49
  collection 'the collection', 3
50
50
  alt 'ja' => 'シリーズ'
51
51
  }
52
- builder.instance_eval { @book.title }.to_s.should == 'the collection'
53
- builder.instance_eval { @book.title.title_type }.to_s.should == 'collection'
54
- builder.instance_eval { @book.title.list_alternates['ja'] }.to_s.should == 'シリーズ'
52
+ expect(builder.instance_eval { @book.title }.to_s).to eq('the collection')
53
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('collection')
54
+ expect(builder.instance_eval { @book.title.list_alternates['ja'] }.to_s).to eq('シリーズ')
55
55
  end
56
56
 
57
57
  it 'should refine title: file_as ' do
@@ -59,9 +59,9 @@ describe GEPUB::Builder do
59
59
  title 'メインタイトル'
60
60
  file_as 'main title'
61
61
  }
62
- builder.instance_eval { @book.title }.to_s.should == 'メインタイトル'
63
- builder.instance_eval { @book.title.title_type }.to_s.should == 'main'
64
- builder.instance_eval { @book.title.file_as }.to_s.should == 'main title'
62
+ expect(builder.instance_eval { @book.title }.to_s).to eq('メインタイトル')
63
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('main')
64
+ expect(builder.instance_eval { @book.title.file_as }.to_s).to eq('main title')
65
65
  end
66
66
 
67
67
  it 'should refine title: alt and file_as ' do
@@ -70,44 +70,44 @@ describe GEPUB::Builder do
70
70
  file_as 'main title'
71
71
  alt 'en' => 'The Main Title'
72
72
  }
73
- builder.instance_eval { @book.title }.to_s.should == 'メインタイトル'
74
- builder.instance_eval { @book.title.title_type }.to_s.should == 'main'
75
- builder.instance_eval { @book.title.file_as }.to_s.should == 'main title'
76
- builder.instance_eval { @book.title.list_alternates['en'] }.to_s.should == 'The Main Title'
73
+ expect(builder.instance_eval { @book.title }.to_s).to eq('メインタイトル')
74
+ expect(builder.instance_eval { @book.title.title_type }.to_s).to eq('main')
75
+ expect(builder.instance_eval { @book.title.file_as }.to_s).to eq('main title')
76
+ expect(builder.instance_eval { @book.title.list_alternates['en'] }.to_s).to eq('The Main Title')
77
77
  end
78
78
 
79
79
  it 'should generate creator ' do
80
80
  builder = GEPUB::Builder.new {
81
81
  creator 'The Main Author'
82
82
  }
83
- builder.instance_eval { @book.creator }.to_s.should == 'The Main Author'
83
+ expect(builder.instance_eval { @book.creator }.to_s).to eq('The Main Author')
84
84
  end
85
85
 
86
86
  it 'should generate creator with role' do
87
87
  builder = GEPUB::Builder.new {
88
88
  creator 'The Illustrator', 'ill'
89
89
  }
90
- builder.instance_eval { @book.creator }.to_s.should == 'The Illustrator'
91
- builder.instance_eval { @book.creator.role}.to_s.should == 'ill'
90
+ expect(builder.instance_eval { @book.creator }.to_s).to eq('The Illustrator')
91
+ expect(builder.instance_eval { @book.creator.role}.to_s).to eq('ill')
92
92
  end
93
93
 
94
94
  it 'should generate contributor ' do
95
95
  builder = GEPUB::Builder.new {
96
96
  contributor 'contributor', 'edt'
97
97
  }
98
- builder.instance_eval { @book.contributor }.to_s.should == 'contributor'
99
- builder.instance_eval { @book.contributor.role}.to_s.should == 'edt'
98
+ expect(builder.instance_eval { @book.contributor }.to_s).to eq('contributor')
99
+ expect(builder.instance_eval { @book.contributor.role}.to_s).to eq('edt')
100
100
  end
101
101
 
102
102
  it 'should generate multiple creators ' do
103
103
  builder = GEPUB::Builder.new {
104
104
  creators 'First Author', 'Second Author', ['Third Person', 'edt']
105
105
  }
106
- builder.instance_eval { @book.creator_list }.size.should == 3
107
- builder.instance_eval { @book.creator_list[0] }.to_s.should == 'First Author'
108
- builder.instance_eval { @book.creator_list[1] }.to_s.should == 'Second Author'
109
- builder.instance_eval { @book.creator_list[2] }.to_s.should == 'Third Person'
110
- builder.instance_eval { @book.creator_list[2].role }.to_s.should == 'edt'
106
+ expect(builder.instance_eval { @book.creator_list }.size).to eq(3)
107
+ expect(builder.instance_eval { @book.creator_list[0] }.to_s).to eq('First Author')
108
+ expect(builder.instance_eval { @book.creator_list[1] }.to_s).to eq('Second Author')
109
+ expect(builder.instance_eval { @book.creator_list[2] }.to_s).to eq('Third Person')
110
+ expect(builder.instance_eval { @book.creator_list[2].role }.to_s).to eq('edt')
111
111
  end
112
112
 
113
113
  it 'should generate multiple creators, and then add file_as at once ' do
@@ -115,14 +115,14 @@ describe GEPUB::Builder do
115
115
  creators 'First Author', 'Second Author', ['Third Person', 'edt']
116
116
  file_as '1st', '2nd', '3rd'
117
117
  }
118
- builder.instance_eval { @book.creator_list }.size.should == 3
119
- builder.instance_eval { @book.creator_list[0] }.to_s.should == 'First Author'
120
- builder.instance_eval { @book.creator_list[0].file_as }.to_s.should == '1st'
121
- builder.instance_eval { @book.creator_list[1] }.to_s.should == 'Second Author'
122
- builder.instance_eval { @book.creator_list[1].file_as }.to_s.should == '2nd'
123
- builder.instance_eval { @book.creator_list[2] }.to_s.should == 'Third Person'
124
- builder.instance_eval { @book.creator_list[2].file_as }.to_s.should == '3rd'
125
- builder.instance_eval { @book.creator_list[2].role }.to_s.should == 'edt'
118
+ expect(builder.instance_eval { @book.creator_list }.size).to eq(3)
119
+ expect(builder.instance_eval { @book.creator_list[0] }.to_s).to eq('First Author')
120
+ expect(builder.instance_eval { @book.creator_list[0].file_as }.to_s).to eq('1st')
121
+ expect(builder.instance_eval { @book.creator_list[1] }.to_s).to eq('Second Author')
122
+ expect(builder.instance_eval { @book.creator_list[1].file_as }.to_s).to eq('2nd')
123
+ expect(builder.instance_eval { @book.creator_list[2] }.to_s).to eq('Third Person')
124
+ expect(builder.instance_eval { @book.creator_list[2].file_as }.to_s).to eq('3rd')
125
+ expect(builder.instance_eval { @book.creator_list[2].role }.to_s).to eq('edt')
126
126
  end
127
127
 
128
128
 
@@ -134,17 +134,17 @@ describe GEPUB::Builder do
134
134
  'en' => ['first','second','third']
135
135
  )
136
136
  }
137
- builder.instance_eval { @book.creator_list }.size.should == 3
138
- builder.instance_eval { @book.creator_list[0] }.to_s.should == 'First Author'
139
- builder.instance_eval { @book.creator_list[0].list_alternates['ja'] }.to_s.should == '最初'
140
- builder.instance_eval { @book.creator_list[0].list_alternates['en'] }.to_s.should == 'first'
141
- builder.instance_eval { @book.creator_list[1] }.to_s.should == 'Second Author'
142
- builder.instance_eval { @book.creator_list[1].list_alternates['ja'] }.to_s.should == '二番目'
143
- builder.instance_eval { @book.creator_list[1].list_alternates['en'] }.to_s.should == 'second'
144
- builder.instance_eval { @book.creator_list[2] }.to_s.should == 'Third Person'
145
- builder.instance_eval { @book.creator_list[2].list_alternates['ja'] }.to_s.should == '三番目'
146
- builder.instance_eval { @book.creator_list[2].list_alternates['en'] }.to_s.should == 'third'
147
- builder.instance_eval { @book.creator_list[2].role }.to_s.should == 'edt'
137
+ expect(builder.instance_eval { @book.creator_list }.size).to eq(3)
138
+ expect(builder.instance_eval { @book.creator_list[0] }.to_s).to eq('First Author')
139
+ expect(builder.instance_eval { @book.creator_list[0].list_alternates['ja'] }.to_s).to eq('最初')
140
+ expect(builder.instance_eval { @book.creator_list[0].list_alternates['en'] }.to_s).to eq('first')
141
+ expect(builder.instance_eval { @book.creator_list[1] }.to_s).to eq('Second Author')
142
+ expect(builder.instance_eval { @book.creator_list[1].list_alternates['ja'] }.to_s).to eq('二番目')
143
+ expect(builder.instance_eval { @book.creator_list[1].list_alternates['en'] }.to_s).to eq('second')
144
+ expect(builder.instance_eval { @book.creator_list[2] }.to_s).to eq('Third Person')
145
+ expect(builder.instance_eval { @book.creator_list[2].list_alternates['ja'] }.to_s).to eq('三番目')
146
+ expect(builder.instance_eval { @book.creator_list[2].list_alternates['en'] }.to_s).to eq('third')
147
+ expect(builder.instance_eval { @book.creator_list[2].role }.to_s).to eq('edt')
148
148
  end
149
149
  end
150
150
  context 'resources' do
@@ -155,8 +155,8 @@ describe GEPUB::Builder do
155
155
  file('text/memo.txt')
156
156
  }
157
157
  }
158
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
159
- builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }.should == 'just a plain text.'
158
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
159
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }).to eq('just a plain text.')
160
160
  end
161
161
 
162
162
  it 'should add files to book' do
@@ -166,9 +166,9 @@ describe GEPUB::Builder do
166
166
  files('text/memo.txt','text/cover.xhtml')
167
167
  }
168
168
  }
169
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
170
- builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }.should == 'just a plain text.'
171
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
169
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
170
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }).to eq('just a plain text.')
171
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
172
172
  end
173
173
 
174
174
  it 'should add files to book with glob' do
@@ -178,9 +178,9 @@ describe GEPUB::Builder do
178
178
  glob 'text/*.{txt,xhtml}'
179
179
  }
180
180
  }
181
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
182
- builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }.should == 'just a plain text.'
183
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
181
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
182
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }).to eq('just a plain text.')
183
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
184
184
  end
185
185
 
186
186
  it 'should add files to book with import with prefix' do
@@ -190,9 +190,9 @@ describe GEPUB::Builder do
190
190
  import 'text/localresource.conf'
191
191
  }
192
192
  }
193
- builder.instance_eval{ @book.item_by_href('memo.txt') }.should_not be_nil
194
- builder.instance_eval{ @book.item_by_href('memo.txt').content.chomp }.should == 'just a plain text.'
195
- builder.instance_eval{ @book.item_by_href('cover.xhtml') }.should_not be_nil
193
+ expect(builder.instance_eval{ @book.item_by_href('memo.txt') }).not_to be_nil
194
+ expect(builder.instance_eval{ @book.item_by_href('memo.txt').content.chomp }).to eq('just a plain text.')
195
+ expect(builder.instance_eval{ @book.item_by_href('cover.xhtml') }).not_to be_nil
196
196
  end
197
197
 
198
198
  it 'should add files to book with import with prefix' do
@@ -202,9 +202,9 @@ describe GEPUB::Builder do
202
202
  import 'text/localresource.conf', :dir_prefix => 'text'
203
203
  }
204
204
  }
205
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
206
- builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }.should == 'just a plain text.'
207
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
205
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
206
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }).to eq('just a plain text.')
207
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
208
208
  end
209
209
 
210
210
  it 'should add a file with id' do
@@ -215,8 +215,8 @@ describe GEPUB::Builder do
215
215
  id 'the_id_of_memo.txt'
216
216
  }
217
217
  }
218
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
219
- builder.instance_eval{ @book.item_by_href('text/memo.txt').id }.should == 'the_id_of_memo.txt'
218
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
219
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').id }).to eq('the_id_of_memo.txt')
220
220
  end
221
221
 
222
222
  it 'should add files to book from IO object' do
@@ -226,8 +226,8 @@ describe GEPUB::Builder do
226
226
  file('text/memo.txt' => io)
227
227
  }
228
228
  }
229
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
230
- builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }.should == 'just a plain text.'
229
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
230
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt').content.chomp }).to eq('just a plain text.')
231
231
  end
232
232
 
233
233
  it 'should add image file as cover' do
@@ -237,8 +237,8 @@ describe GEPUB::Builder do
237
237
  cover_image 'img/cover.jpg'
238
238
  }
239
239
  }
240
- builder.instance_eval{ @book.item_by_href('img/cover.jpg') }.should_not be_nil
241
- builder.instance_eval{ @book.item_by_href('img/cover.jpg').properties.member? 'cover-image' }.should == true
240
+ expect(builder.instance_eval{ @book.item_by_href('img/cover.jpg') }).not_to be_nil
241
+ expect(builder.instance_eval{ @book.item_by_href('img/cover.jpg').properties.member? 'cover-image' }).to eq(true)
242
242
  end
243
243
 
244
244
  it 'should add file as nav' do
@@ -248,8 +248,8 @@ describe GEPUB::Builder do
248
248
  nav 'text/nav.xhtml'
249
249
  }
250
250
  }
251
- builder.instance_eval{ @book.item_by_href('text/nav.xhtml') }.should_not be_nil
252
- builder.instance_eval{ @book.item_by_href('text/nav.xhtml').properties.member? 'nav' }.should == true
251
+ expect(builder.instance_eval{ @book.item_by_href('text/nav.xhtml') }).not_to be_nil
252
+ expect(builder.instance_eval{ @book.item_by_href('text/nav.xhtml').properties.member? 'nav' }).to eq(true)
253
253
  end
254
254
 
255
255
  it 'should specify mediatype' do
@@ -260,8 +260,8 @@ describe GEPUB::Builder do
260
260
  media_type('audio/mp4')
261
261
  }
262
262
  }
263
- builder.instance_eval{ @book.item_by_href('resources/noise.m4') }.should_not be_nil
264
- builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }.should == 'audio/mp4'
263
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4') }).not_to be_nil
264
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }).to eq('audio/mp4')
265
265
  end
266
266
 
267
267
  it 'should specify mediatype to files' do
@@ -272,11 +272,11 @@ describe GEPUB::Builder do
272
272
  media_type('audio/mp4')
273
273
  }
274
274
  }
275
- builder.instance_eval{ @book.item_by_href('resources/noise.m4') }.should_not be_nil
276
- builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }.should == 'audio/mp4'
275
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4') }).not_to be_nil
276
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }).to eq('audio/mp4')
277
277
 
278
- builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a') }.should_not be_nil
279
- builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a').media_type }.should == 'audio/mp4'
278
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a') }).not_to be_nil
279
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a').media_type }).to eq('audio/mp4')
280
280
  end
281
281
 
282
282
  it 'should specify mediatype to files using with_media_type' do
@@ -290,14 +290,14 @@ describe GEPUB::Builder do
290
290
  file('text/cover.xhtml')
291
291
  }
292
292
  }
293
- builder.instance_eval{ @book.item_by_href('resources/noise.m4') }.should_not be_nil
294
- builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }.should == 'audio/mp4'
293
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4') }).not_to be_nil
294
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise.m4').media_type }).to eq('audio/mp4')
295
295
 
296
- builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a') }.should_not be_nil
297
- builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a').media_type }.should == 'audio/mp4'
296
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a') }).not_to be_nil
297
+ expect(builder.instance_eval{ @book.item_by_href('resources/noise_2.m4a').media_type }).to eq('audio/mp4')
298
298
 
299
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
300
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml').media_type }.should == 'application/xhtml+xml'
299
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
300
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml').media_type }).to eq('application/xhtml+xml')
301
301
  end
302
302
 
303
303
  it 'should specify bindings handler' do
@@ -322,10 +322,10 @@ describe GEPUB::Builder do
322
322
  }
323
323
  }
324
324
  }
325
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
326
- builder.instance_eval{ @book.spine_items[0].href }.should == 'text/cover.xhtml'
327
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
328
- builder.instance_eval{ @book.spine_items[1].href }.should == 'text/memo.txt'
325
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
326
+ expect(builder.instance_eval{ @book.spine_items[0].href }).to eq('text/cover.xhtml')
327
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
328
+ expect(builder.instance_eval{ @book.spine_items[1].href }).to eq('text/memo.txt')
329
329
  end
330
330
 
331
331
  it 'should add files and heading' do
@@ -340,14 +340,14 @@ describe GEPUB::Builder do
340
340
  }
341
341
  }
342
342
  }
343
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
344
- builder.instance_eval{ @book.spine_items[0].href }.should == 'text/cover.xhtml'
345
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
346
- builder.instance_eval{ @book.spine_items[1].href }.should == 'text/memo.txt'
347
- builder.instance_eval{ @book.instance_eval { @toc[0][:item].href }}.should == 'text/cover.xhtml'
348
- builder.instance_eval{ @book.instance_eval { @toc[0][:text] }}.should == 'cover page'
349
- builder.instance_eval{ @book.instance_eval { @toc[1][:item].href }}.should == 'text/memo.txt'
350
- builder.instance_eval{ @book.instance_eval { @toc[1][:text] }}.should == 'memo text'
343
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
344
+ expect(builder.instance_eval{ @book.spine_items[0].href }).to eq('text/cover.xhtml')
345
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
346
+ expect(builder.instance_eval{ @book.spine_items[1].href }).to eq('text/memo.txt')
347
+ expect(builder.instance_eval{ @book.instance_eval { @toc[0][:item].href }}).to eq('text/cover.xhtml')
348
+ expect(builder.instance_eval{ @book.instance_eval { @toc[0][:text] }}).to eq('cover page')
349
+ expect(builder.instance_eval{ @book.instance_eval { @toc[1][:item].href }}).to eq('text/memo.txt')
350
+ expect(builder.instance_eval{ @book.instance_eval { @toc[1][:text] }}).to eq('memo text')
351
351
  end
352
352
 
353
353
  it 'should add files and page-spread-property' do
@@ -362,10 +362,10 @@ describe GEPUB::Builder do
362
362
  }
363
363
  }
364
364
  }
365
- builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }.should_not be_nil
366
- builder.instance_eval{ @book.spine.itemref_list[0].properties[0] }.should == 'page-spread-left'
367
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
368
- builder.instance_eval{ @book.spine.itemref_list[1].properties[0] }.should == 'page-spread-right'
365
+ expect(builder.instance_eval{ @book.item_by_href('text/cover.xhtml') }).not_to be_nil
366
+ expect(builder.instance_eval{ @book.spine.itemref_list[0].properties[0] }).to eq('page-spread-left')
367
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
368
+ expect(builder.instance_eval{ @book.spine.itemref_list[1].properties[0] }).to eq('page-spread-right')
369
369
  end
370
370
 
371
371
  it 'should add files and rendition property' do
@@ -381,10 +381,10 @@ describe GEPUB::Builder do
381
381
  }
382
382
  }
383
383
  }
384
- builder.instance_eval{ @book.item_by_href('text/memo.txt') }.should_not be_nil
385
- builder.instance_eval{ @book.spine.itemref_list[1].properties[0] }.should == 'rendition:layout-pre-paginated'
386
- builder.instance_eval{ @book.spine.itemref_list[1].properties[1] }.should == 'rendition:orientation-landscape'
387
- builder.instance_eval{ @book.spine.itemref_list[1].properties[2] }.should == 'rendition:spread-both'
384
+ expect(builder.instance_eval{ @book.item_by_href('text/memo.txt') }).not_to be_nil
385
+ expect(builder.instance_eval{ @book.spine.itemref_list[1].properties[0] }).to eq('rendition:layout-pre-paginated')
386
+ expect(builder.instance_eval{ @book.spine.itemref_list[1].properties[1] }).to eq('rendition:orientation-landscape')
387
+ expect(builder.instance_eval{ @book.spine.itemref_list[1].properties[2] }).to eq('rendition:spread-both')
388
388
  builder.instance_eval{
389
389
  xml = Nokogiri::XML::Document.parse @book.opf_xml
390
390
  xml.root['prefix'].should == 'rendition: http://www.idpf.org/vocab/rendition/#'
@@ -587,9 +587,9 @@ describe GEPUB::Builder do
587
587
  builder.instance_eval {
588
588
  @book.optional_files.size.should == 1
589
589
  }
590
- builder.instance_eval {
590
+ expect(builder.instance_eval {
591
591
  @book.optional_files['META-INF/test.xml']
592
- }.should_not be_nil
592
+ }).not_to be_nil
593
593
  end
594
594
  end
595
595
  end