3 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
5 # See LICENSE.txt for permissions.
9 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
10 require 'rubygems/package'
12 class TestKernel < RubyGemTestCase
29 assert gem('a', '= 1'), "Should load"
30 assert $:.any? { |p| %r{a-1/lib} =~ p }
31 assert $:.any? { |p| %r{a-1/bin} =~ p }
34 def test_gem_redundent
35 assert gem('a', '= 1'), "Should load"
36 assert ! gem('a', '= 1'), "Should not load"
37 assert_equal 1, $:.select { |p| %r{a-1/lib} =~ p }.size
38 assert_equal 1, $:.select { |p| %r{a-1/bin} =~ p }.size
41 def test_gem_overlapping
42 assert gem('a', '= 1'), "Should load"
43 assert ! gem('a', '>= 1'), "Should not load"
44 assert_equal 1, $:.select { |p| %r{a-1/lib} =~ p }.size
45 assert_equal 1, $:.select { |p| %r{a-1/bin} =~ p }.size
48 def test_gem_conflicting
49 assert gem('a', '= 1'), "Should load"
51 ex = assert_raise Gem::Exception do
55 assert_match(/activate a \(= 2\)/, ex.message)
56 assert_match(/activated a-1/, ex.message)
58 assert $:.any? { |p| %r{a-1/lib} =~ p }
59 assert $:.any? { |p| %r{a-1/bin} =~ p }
60 assert ! $:.any? { |p| %r{a-2/lib} =~ p }
61 assert ! $:.any? { |p| %r{a-2/bin} =~ p }