test/test_epubmaker.rb in review-5.1.1 vs test/test_epubmaker.rb in review-5.2.0

- old
+ new

@@ -11,10 +11,12 @@ 'urnid' => 'http://example.jp/', 'date' => '2011-01-01', 'language' => 'en', 'titlepage' => nil ) + @log_io = StringIO.new + ReVIEW.logger = ReVIEW::Logger.new(@log_io) @producer = ReVIEW::EPUBMaker::Producer.new(config) end def test_initialize assert ReVIEW::EPUBMaker::Producer.new(ReVIEW::Configure.values) @@ -899,43 +901,46 @@ epubmaker_instance do |epubmaker, tmpdir| epubmaker.config['stylesheet'] = ['exist.css'] assert_nothing_raised { epubmaker.copy_stylesheet(tmpdir) } epubmaker.config['stylesheet'] = ['nothing.css'] - e = assert_raise(ApplicationError) { epubmaker.copy_stylesheet(tmpdir) } - assert_equal 'stylesheet: nothing.css is not found.', e.message + assert_raise(SystemExit) { epubmaker.copy_stylesheet(tmpdir) } + assert_equal "ERROR --: stylesheet: nothing.css is not found.\n", @log_io.string end epubmaker_instance do |epubmaker, tmpdir| epubmaker.config['titlepage'] = true epubmaker.config['titlefile'] = 'exist.html' assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) } epubmaker.config['titlefile'] = 'nothing.html' - e = assert_raise(ApplicationError) { epubmaker.copy_frontmatter(tmpdir) } - assert_equal 'titlefile: nothing.html is not found.', e.message + @log_io.string = '' + assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) } + assert_equal "ERROR --: titlefile: nothing.html is not found.\n", @log_io.string end # XXX: only `cover' is allowed to have invalid file name. %w[originaltitlefile creditfile].each do |name| epubmaker_instance do |epubmaker, tmpdir| epubmaker.config[name] = 'exist.html' assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) } epubmaker.config[name] = 'nothing.html' - e = assert_raise(ApplicationError) { epubmaker.copy_frontmatter(tmpdir) } - assert_equal "#{name}: nothing.html is not found.", e.message + @log_io.string = '' + assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) } + assert_equal "ERROR --: #{name}: nothing.html is not found.\n", @log_io.string end end %w[profile advfile colophon backcover].each do |name| epubmaker_instance do |epubmaker, tmpdir| epubmaker.config[name] = 'exist.html' assert_nothing_raised { epubmaker.copy_backmatter(tmpdir) } epubmaker.config[name] = 'nothing.html' - e = assert_raise(ApplicationError) { epubmaker.copy_backmatter(tmpdir) } - assert_equal "#{name}: nothing.html is not found.", e.message + @log_io.string = '' + assert_raise(SystemExit) { epubmaker.copy_backmatter(tmpdir) } + assert_equal "ERROR --: #{name}: nothing.html is not found.\n", @log_io.string end end end end