OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / test / rubygems / test_gem_gem_runner.rb
1 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
2 require 'rubygems/gem_runner'
3
4 class TestGemGemRunner < RubyGemTestCase
5
6   def test_do_configuration
7     Gem.clear_paths
8
9     temp_conf = File.join @tempdir, '.gemrc'
10
11     other_gem_path = File.join @tempdir, 'other_gem_path'
12     other_gem_home = File.join @tempdir, 'other_gem_home'
13
14     Gem.ensure_gem_subdirectories other_gem_path
15     Gem.ensure_gem_subdirectories other_gem_home
16
17     File.open temp_conf, 'w' do |fp|
18       fp.puts "gem: --commands"
19       fp.puts "gemhome: #{other_gem_home}"
20       fp.puts "gempath:"
21       fp.puts "  - #{other_gem_path}"
22       fp.puts "rdoc: --all"
23     end
24
25     gr = Gem::GemRunner.new
26     gr.send :do_configuration, %W[--config-file #{temp_conf}]
27
28     assert_equal [other_gem_path, other_gem_home], Gem.path
29     assert_equal %w[--commands], Gem::Command.extra_args
30     assert_equal %w[--all], Gem::DocManager.configured_args
31   end
32
33 end
34