test/test_epubmaker_cmd.rb in review-1.1.0 vs test/test_epubmaker_cmd.rb in review-1.2.0

- old
+ new

@@ -2,10 +2,11 @@ require 'test_helper' require 'tmpdir' require 'fileutils' require 'yaml' +require 'rbconfig' REVIEW_EPUBMAKER = File.expand_path('../bin/review-epubmaker', File.dirname(__FILE__)) class EPUBMakerCmdTest < Test::Unit::TestCase def setup @@ -21,16 +22,19 @@ FileUtils.rm_rf @tmpdir2 ENV['RUBYLIB'] = @old_rubylib end def test_epubmaker_cmd - config = prepare_samplebook(@tmpdir1) - builddir = @tmpdir1 + "/" + config['bookname'] + '-epub' - assert ! File.exists?(builddir) + if RUBY_VERSION !~ /^1.8/ + config = prepare_samplebook(@tmpdir1) + builddir = @tmpdir1 + "/" + config['bookname'] + '-epub' + assert ! File.exist?(builddir) - Dir.chdir(@tmpdir1) do - system("#{REVIEW_EPUBMAKER} config.yml 1>/dev/null 2>/dev/null") - end + ruby_cmd = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) + Dir.chdir(@tmpdir1) do + system("#{ruby_cmd} -S #{REVIEW_EPUBMAKER} config.yml 1>/dev/null 2>/dev/null") + end - assert File.exists?(builddir) + assert File.exist?(builddir) + end end end