2
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
4
# See LICENSE.txt for permissions.
7
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
8
require 'rubygems/package'
10
class TestKernel < RubyGemTestCase
27
assert gem('a', '= 1'), "Should load"
28
assert $:.any? { |p| %r{a-1/lib} =~ p }
29
assert $:.any? { |p| %r{a-1/bin} =~ p }
32
def test_gem_redundent
33
assert gem('a', '= 1'), "Should load"
34
assert ! gem('a', '= 1'), "Should not load"
35
assert_equal 1, $:.select { |p| %r{a-1/lib} =~ p }.size
36
assert_equal 1, $:.select { |p| %r{a-1/bin} =~ p }.size
39
def test_gem_overlapping
40
assert gem('a', '= 1'), "Should load"
41
assert ! gem('a', '>= 1'), "Should not load"
42
assert_equal 1, $:.select { |p| %r{a-1/lib} =~ p }.size
43
assert_equal 1, $:.select { |p| %r{a-1/bin} =~ p }.size
46
def test_gem_conflicting
47
assert gem('a', '= 1'), "Should load"
49
ex = assert_raises Gem::Exception do
53
assert_match(/activate a \(= 2, runtime\)/, ex.message)
54
assert_match(/activated a-1/, ex.message)
56
assert $:.any? { |p| %r{a-1/lib} =~ p }
57
assert $:.any? { |p| %r{a-1/bin} =~ p }
58
assert ! $:.any? { |p| %r{a-2/lib} =~ p }
59
assert ! $:.any? { |p| %r{a-2/bin} =~ p }