diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-17 02:08:53 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-17 02:08:53 +0000 |
commit | a35798450864ee9515e1742627fb592a40c0c44a (patch) | |
tree | 0692694d9abf1c1d4832a984a8f8a2b708b1874a /test/rubygems | |
parent | 6944271c0d18336376f63b3dda442a18202a4c1b (diff) | |
download | bundler-a35798450864ee9515e1742627fb592a40c0c44a.tar.gz |
* lib/rubygems: Update to RubyGems master 941c21a. Changes:
Restored method bundler wants to remove for compatibility.
Improvements to Gemfile compatibility.
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_gem_request_set_gem_dependency_api.rb | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb new file mode 100644 index 0000000000..4747250f60 --- /dev/null +++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb @@ -0,0 +1,154 @@ +require 'rubygems/test_case' +require 'rubygems/request_set' + +class TestGemRequestSetGemDependencyAPI < Gem::TestCase + + def setup + super + + @GDA = Gem::RequestSet::GemDependencyAPI + + @set = Gem::RequestSet.new + + @gda = @GDA.new @set, 'gem.deps.rb' + end + + def test_gem + @gda.gem 'a' + + assert_equal [dep('a')], @set.dependencies + end + + def test_gem_group + @gda.gem 'a', :group => :test + + expected = { + :test => [['a']], + } + + assert_equal expected, @gda.dependency_groups + + assert_empty @set.dependencies + end + + def test_gem_groups + @gda.gem 'a', :groups => [:test, :development] + + expected = { + :development => [['a']], + :test => [['a']], + } + + assert_equal expected, @gda.dependency_groups + + assert_empty @set.dependencies + end + + def test_gem_requirement + @gda.gem 'a', '~> 1.0' + + assert_equal [dep('a', '~> 1.0')], @set.dependencies + end + + def test_gem_requirements + @gda.gem 'b', '~> 1.0', '>= 1.0.2' + + assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies + end + + def test_gem_requirements_options + @gda.gem 'c', :git => 'https://example/c.git' + + assert_equal [dep('c')], @set.dependencies + end + + def test_gem_deps_file + assert_equal 'gem.deps.rb', @gda.gem_deps_file + + gda = @GDA.new @set, 'foo/Gemfile' + + assert_equal 'Gemfile', gda.gem_deps_file + end + + def test_group + @gda.group :test do + @gda.gem 'a' + end + + assert_equal [['a']], @gda.dependency_groups[:test] + + assert_empty @set.dependencies + end + + def test_load + Tempfile.open 'gem.deps.rb' do |io| + io.write <<-GEM_DEPS +gem 'a' + +group :test do + gem 'b' +end + GEM_DEPS + io.flush + + gda = @GDA.new @set, io.path + + gda.load + + expected = { + :test => [['b']], + } + + assert_equal expected, gda.dependency_groups + + assert_equal [dep('a')], @set.dependencies + end + end + + def test_name_typo + assert_same @GDA, Gem::RequestSet::DepedencyAPI + end + + def test_platform_mswin + @gda.platform :mswin do + @gda.gem 'a' + end + + assert_empty @set.dependencies + end + + def test_platform_ruby + @gda.platform :ruby do + @gda.gem 'a' + end + + assert_equal [dep('a')], @set.dependencies + end + + def test_platforms + @gda.platforms :ruby do + @gda.gem 'a' + end + + assert_equal [dep('a')], @set.dependencies + end + + def test_ruby + assert @gda.ruby RUBY_VERSION + end + + def test_ruby_engine + assert @gda.ruby RUBY_VERSION, + :engine => 'jruby', :engine_version => '1.7.4' + end + + def test_ruby_mismatch + e = assert_raises Gem::RubyVersionMismatch do + @gda.ruby '1.8.0' + end + + assert_equal "Your Ruby version is #{RUBY_VERSION}, but your gem.deps.rb specified 1.8.0", e.message + end + +end + |