diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/test/rubygems/test_gem_commands_pristine_command.rb | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/test/rubygems/test_gem_commands_pristine_command.rb')
-rw-r--r-- | trunk/test/rubygems/test_gem_commands_pristine_command.rb | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/trunk/test/rubygems/test_gem_commands_pristine_command.rb b/trunk/test/rubygems/test_gem_commands_pristine_command.rb deleted file mode 100644 index d5d2d7f339..0000000000 --- a/trunk/test/rubygems/test_gem_commands_pristine_command.rb +++ /dev/null @@ -1,109 +0,0 @@ -require 'test/unit' -require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') -require 'rubygems/commands/pristine_command' - -class TestGemCommandsPristineCommand < RubyGemTestCase - - def setup - super - @cmd = Gem::Commands::PristineCommand.new - end - - def test_execute - a = quick_gem 'a' do |s| s.executables = %w[foo] end - FileUtils.mkdir_p File.join(@tempdir, 'bin') - File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp| - fp.puts "#!/usr/bin/ruby" - end - - install_gem a - - foo_path = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo' - - File.open foo_path, 'w' do |io| - io.puts 'I changed it!' - end - - @cmd.options[:args] = %w[a] - - use_ui @ui do - @cmd.execute - end - - assert_equal "#!/usr/bin/ruby\n", File.read(foo_path), foo_path - - out = @ui.output.split "\n" - - assert_equal "Restoring gem(s) to pristine condition...", out.shift - assert_equal "Restored #{a.full_name}", out.shift - assert out.empty?, out.inspect - end - - def test_execute_all - a = quick_gem 'a' do |s| s.executables = %w[foo] end - FileUtils.mkdir_p File.join(@tempdir, 'bin') - File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp| - fp.puts "#!/usr/bin/ruby" - end - - install_gem a - - gem_bin = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo' - - FileUtils.rm gem_bin - - @cmd.handle_options %w[--all] - - use_ui @ui do - @cmd.execute - end - - assert File.exist?(gem_bin) - - out = @ui.output.split "\n" - - assert_equal "Restoring gem(s) to pristine condition...", out.shift - assert_equal "Restored #{a.full_name}", out.shift - assert out.empty?, out.inspect - end - - def test_execute_missing_cache_gem - a = quick_gem 'a' do |s| s.executables = %w[foo] end - FileUtils.mkdir_p File.join(@tempdir, 'bin') - File.open File.join(@tempdir, 'bin', 'foo'), 'w' do |fp| - fp.puts "#!/usr/bin/ruby" - end - - install_gem a - - FileUtils.rm File.join(@gemhome, 'cache', "#{a.full_name}.gem") - - @cmd.options[:args] = %w[a] - - use_ui @ui do - @cmd.execute - end - - out = @ui.output.split "\n" - - assert_equal "Restoring gem\(s\) to pristine condition...", out.shift - assert out.empty?, out.inspect - - assert_equal "ERROR: Cached gem for #{a.full_name} not found, use `gem install` to restore\n", - @ui.error - end - - def test_execute_no_gem - @cmd.options[:args] = %w[] - - e = assert_raise Gem::CommandLineError do - use_ui @ui do - @cmd.execute - end - end - - assert_match %r|specify a gem name|, e.message - end - -end - |