Sha256: 10632c0b4079b1d83bd541afa7787844a0095aa3500a5837debbf710352d98d0

Contents?: true

Size: 1023 Bytes

Versions: 11

Compression:

Stored size: 1023 Bytes

Contents

require "isolate"
require "minitest/autorun"

module Isolate
  class Test < MiniTest::Unit::TestCase
    def setup
      Isolate.refresh

      @env = ENV.to_hash
      @lp  = $LOAD_PATH.dup
      @lf  = $LOADED_FEATURES.dup
    end

    def teardown
      Gem::DependencyInstaller.reset_value
      Gem::Uninstaller.reset_value

      ENV.replace @env
      $LOAD_PATH.replace @lp
      $LOADED_FEATURES.replace @lf

      FileUtils.rm_rf "tmp/isolate"
    end
  end
end

module BrutalStub
  @@value = []
  def value; @@value end
  def reset_value; value.clear end
end

class Gem::DependencyInstaller
  extend BrutalStub

  alias old_install install
  def install name, requirement
    self.class.value << [name, requirement]
  end
end

class Gem::Uninstaller
  extend BrutalStub

  attr_reader :gem, :version, :gem_home
  alias old_uninstall uninstall

  def uninstall
    self.class.value << [self.gem,
                         self.version.to_s,
                         self.gem_home.sub(Dir.pwd + "/", '')]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
isolate-3.0.0 test/isolate/test.rb
isolate-2.1.2 test/isolate/test.rb
isolate-2.1.1 test/isolate/test.rb
isolate-2.1.0 test/isolate/test.rb
isolate-2.0.2 test/isolate/test.rb
isolate-2.0.1 test/isolate/test.rb
isolate-2.0.0 test/isolate/test.rb
isolate-2.0.0.pre.3 test/isolate/test.rb
isolate-2.0.0.pre.2 test/isolate/test.rb
isolate-2.0.0.pre.1 test/isolate/test.rb
isolate-2.0.0.pre.0 test/isolate/test.rb