Sha256: 5b0b614b0d1aedb0998cfd7f1cd63337a03874e1d0429b8a2e11515a90144e76

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'rubygems'
require 'test/mockgemui'
require 'test/gemenvironment'

Gem.manage_gems

class TestGemLoadPaths < Test::Unit::TestCase
  include Gem::DefaultUserInteraction

  def setup
    TestEnvironment.create
    Gem.clear_paths
    Gem.use_paths("test/data/gemhome")
  end

  def test_all_load_paths
    assert_equal [
      "test/data/gemhome/gems/a-0.0.1/lib",
      "test/data/gemhome/gems/a-0.0.2/lib",
      "test/data/gemhome/gems/b-0.0.2/lib",
      "test/data/gemhome/gems/c-1.2/lib"].sort,
      Gem.all_load_paths.sort
  end

  def test_latest_load_paths
    assert_equal [
      "test/data/gemhome/gems/a-0.0.2/lib",
      "test/data/gemhome/gems/b-0.0.2/lib",
      "test/data/gemhome/gems/c-1.2/lib"].sort,
      Gem.latest_load_paths.sort
  end

  def test_required_location
    assert_equal "test/data/gemhome/gems/c-1.2/lib/code.rb",
      Gem.required_location("c", "code.rb")
    assert_equal "test/data/gemhome/gems/a-0.0.1/lib/code.rb",
      Gem.required_location("a", "code.rb", "<0.0.2")
    assert_equal "test/data/gemhome/gems/a-0.0.2/lib/code.rb",
      Gem.required_location("a", "code.rb", "=0.0.2")
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubygems-update-0.8.11 test/test_gemloadpaths.rb
rubygems-update-0.8.4 test/test_gemloadpaths.rb
rubygems-update-0.8.6 test/test_gemloadpaths.rb
rubygems-update-0.8.5 test/test_gemloadpaths.rb
rubygems-update-0.8.8 test/test_gemloadpaths.rb
rubygems-update-0.8.3 test/test_gemloadpaths.rb
rubygems-update-0.8.10 test/test_gemloadpaths.rb