Sha256: e8740b3f65a645a01a2fd53705ca31f89108ab074247e0c38581f75f5baf1f27

Contents?: true

Size: 1017 Bytes

Versions: 7

Compression:

Stored size: 1017 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.at(gem_file).install rescue 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', :executables => true).uninstall rescue nil
    $:.delete kindlegen_lib_dir if kindlegen_lib_dir
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kindlegen-3.1.0 test/test_kindlegen.rb
kindlegen-3.0.5 test/test_kindlegen.rb
kindlegen-3.0.4 test/test_kindlegen.rb
kindlegen-3.0.3 test/test_kindlegen.rb
kindlegen-3.0.2 test/test_kindlegen.rb
kindlegen-3.0.1 test/test_kindlegen.rb
kindlegen-3.0.0 test/test_kindlegen.rb