Sha256: a2f15ca885e604feeafa84f157c5153cece944e52957c242dc0c3803c509aa9c

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

require 'test/unit'
require 'rubygems/installer'
require 'rubygems/uninstaller'
KINDLEGEN_PROJECT_DIR = File.expand_path(File.dirname(File.dirname(__FILE__)))
$:.delete(File.join(KINDLEGEN_PROJECT_DIR, 'lib'))

class KindlegenTest < Test::Unit::TestCase
  def test_gem_install
    kindlegen_lib_dir = nil
    gem_version = File.read(File.join(KINDLEGEN_PROJECT_DIR, 'lib/kindlegen/version.rb')).match(/VERSION = ["'](.*?)["']/)[1]
    gem_file = File.join(KINDLEGEN_PROJECT_DIR, 'pkg', %(kindlegen-#{gem_version}.gem))
    result = Gem::Installer.new(gem_file).install
    begin
      require 'kindlegen'
    rescue ::LoadError
      Dir.glob(result.lib_dirs_glob).each do |path|
        $:.unshift path
      end
      require 'kindlegen'
    end
    output = %x(#{Kindlegen.command})
    assert output.include?('Amazon')
  ensure
    Gem::Uninstaller.new('kindlegen', :force => true).uninstall rescue nil
    $:.delete kindlegen_lib_dir if kindlegen_lib_dir
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kindlegen-2.9.7 test/test_kindlegen.rb
kindlegen-2.9.6 test/test_kindlegen.rb
kindlegen-2.9.5 test/test_kindlegen.rb