summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_setup_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 04:30:12 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-30 04:30:12 +0000
commit42968fe65af25c6348719272c3e81f721e4a5a35 (patch)
tree783500b77acbb98ed09367bd23d89a02697e9259 /test/rubygems/test_gem_commands_setup_command.rb
parent3c4633a3a1ace272566618c9e002489d3c03b569 (diff)
* lib/rubygems/commands/setup_command.rb: Remove old files on install
of RubyGems. (not by rbinstall.rb). * test/rubygems/test_gem_commands_setup_command.rb: Test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
new file mode 100644
index 0000000000..9db6468337
--- /dev/null
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -0,0 +1,45 @@
+require 'rubygems/test_case'
+require 'rubygems/commands/setup_command'
+
+class TestGemCommandsSetupCommand < Gem::TestCase
+
+ def setup
+ super
+
+ @install_dir = File.join @tempdir, 'install'
+ @cmd = Gem::Commands::SetupCommand.new
+ @cmd.options[:prefix] = @install_dir
+
+ FileUtils.mkdir_p 'bin'
+ FileUtils.mkdir_p 'lib/rubygems'
+
+ open 'bin/gem', 'w' do |io| io.puts '# gem' end
+ open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
+ open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
+ end
+
+ def test_rb_files_in
+ assert_equal %w[rubygems.rb rubygems/test_case.rb],
+ @cmd.rb_files_in('lib').sort
+ end
+
+ def test_remove_old_lib_files
+ lib = File.join @install_dir, 'lib'
+ lib_rubygems = File.join lib, 'rubygems'
+
+ old_builder_rb = File.join lib_rubygems, 'builder.rb'
+ old_format_rb = File.join lib_rubygems, 'format.rb'
+
+ FileUtils.mkdir_p lib_rubygems
+
+ open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
+ open old_format_rb, 'w' do |io| io.puts '# format.rb' end
+
+ @cmd.remove_old_lib_files lib
+
+ refute_path_exists old_builder_rb
+ refute_path_exists old_format_rb
+ end
+
+end
+