summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_update_command.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-07 08:39:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-07 08:39:39 +0000
commiteb807d42eca121df22f72b95465bba52a4e7fefa (patch)
tree35b722bc6c94d3b9c5f8f80d41e889c591a80450 /test/rubygems/test_gem_commands_update_command.rb
parentc414d861c109ff546e2bc8c7264859907d6e0f76 (diff)
* gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_update_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb202
1 files changed, 10 insertions, 192 deletions
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 24966a3a84..6c16713130 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -7,12 +7,6 @@
require 'rubygems/test_case'
require 'rubygems/commands/update_command'
-begin
- gem "rdoc"
-rescue Gem::LoadError
- # ignore
-end
-
class TestGemCommandsUpdateCommand < Gem::TestCase
def setup
@@ -25,8 +19,8 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
util_setup_fake_fetcher
- @a1_path = Gem.cache_gem(@a1.file_name, @gemhome)
- @a2_path = Gem.cache_gem(@a2.file_name, @gemhome)
+ @a1_path = File.join @gemhome, 'cache', @a1.file_name
+ @a2_path = File.join @gemhome, 'cache', @a2.file_name
util_setup_spec_fetcher @a1, @a2
@@ -42,8 +36,8 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
Gem::Installer.new(@a1_path).install
@cmd.options[:args] = []
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
+ @cmd.options[:generate_rdoc] = true
+ @cmd.options[:generate_ri] = true
use_ui @ui do
@cmd.execute
@@ -54,153 +48,12 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_equal "Updating #{@a2.name}", out.shift
assert_equal "Successfully installed #{@a2.full_name}", out.shift
assert_equal "Gems updated: #{@a2.name}", out.shift
- assert_empty out
- end
-
- def util_setup_rubygem version
- gem = quick_spec('rubygems-update', version.to_s) do |s|
- s.files = %w[setup.rb]
- end
- write_file File.join(*%W[gems #{gem.original_name} setup.rb])
- util_build_gem gem
- util_setup_spec_fetcher gem
- gem
- end
-
- def util_setup_rubygem8
- @rubygem8 = util_setup_rubygem 8
- end
-
- def util_setup_rubygem9
- @rubygem9 = util_setup_rubygem 9
- end
-
- def util_setup_rubygem_current
- @rubygem_current = util_setup_rubygem Gem::VERSION
- end
-
- def util_add_to_fetcher *specs
- specs.each do |spec|
- gem_file = Gem.cache_gem(spec.file_name, @gemhome)
-
- @fetcher.data["http://gems.example.com/gems/#{spec.file_name}"] =
- Gem.read_binary gem_file
- end
- end
-
- def test_execute_system
- util_setup_rubygem9
- util_setup_spec_fetcher @rubygem9
- util_add_to_fetcher @rubygem9
- util_clear_gems
-
- @cmd.options[:args] = []
- @cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
-
- use_ui @ui do
- @cmd.execute
- end
-
- out = @ui.output.split "\n"
- assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-9", out.shift
- assert_equal "Installing RubyGems 9", out.shift
- assert_equal "RubyGems system software updated", out.shift
-
- assert_empty out
- end
-
- def test_execute_system_at_latest
- util_setup_rubygem_current
- util_setup_spec_fetcher @rubygem_current
- util_add_to_fetcher @rubygem_current
- util_clear_gems
-
- @cmd.options[:args] = []
- @cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
-
- assert_raises Gem::SystemExitException do
- use_ui @ui do
- @cmd.execute
- end
- end
-
- out = @ui.output.split "\n"
- assert_equal "Latest version currently installed. Aborting.", out.shift
- assert_empty out
- end
-
- def test_execute_system_multiple
- util_setup_rubygem9
- util_setup_rubygem8
- util_setup_spec_fetcher @rubygem8, @rubygem9
- util_add_to_fetcher @rubygem8, @rubygem9
- util_clear_gems
-
- @cmd.options[:args] = []
- @cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
-
- use_ui @ui do
- @cmd.execute
- end
-
- out = @ui.output.split "\n"
- assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-9", out.shift
- assert_equal "Installing RubyGems 9", out.shift
- assert_equal "RubyGems system software updated", out.shift
-
- assert_empty out
- end
-
- def test_execute_system_specific
- util_clear_gems
- util_setup_rubygem9
- util_setup_rubygem8
- util_setup_spec_fetcher @rubygem8, @rubygem9
- util_add_to_fetcher @rubygem8, @rubygem9
-
- @cmd.options[:args] = []
- @cmd.options[:system] = "8"
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
-
- use_ui @ui do
- @cmd.execute
- end
-
- out = @ui.output.split "\n"
- assert_equal "Updating rubygems-update", out.shift
- assert_equal "Successfully installed rubygems-update-8", out.shift
- assert_equal "Installing RubyGems 8", out.shift
- assert_equal "RubyGems system software updated", out.shift
+ assert_equal "Installing ri documentation for a-2...", out.shift
+ assert_equal "Installing RDoc documentation for a-2...", out.shift
assert_empty out
end
- def test_execute_system_with_gems
- @cmd.options[:args] = %w[gem]
- @cmd.options[:system] = true
- @cmd.options[:generate_rdoc] = false
- @cmd.options[:generate_ri] = false
-
- assert_raises Gem::MockGemUi::TermError do
- use_ui @ui do
- @cmd.execute
- end
- end
-
- assert_empty @ui.output
- assert_equal "ERROR: Gem names are not allowed with the --system option\n",
- @ui.error
- end
-
# before:
# a1 -> c1.2
# after:
@@ -210,7 +63,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_dependencies
@a1.add_dependency 'c', '1.2'
- @c2 = quick_spec 'c', '2' do |s|
+ @c2 = quick_gem 'c', '2' do |s|
s.files = %w[lib/code.rb]
s.require_paths = %w[lib]
end
@@ -218,9 +71,9 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@a2.add_dependency 'c', '2'
@a2.add_dependency 'b', '2'
- @b2_path = Gem.cache_gem(@b2.file_name, @gemhome)
- @c1_2_path = Gem.cache_gem(@c1_2.file_name, @gemhome)
- @c2_path = Gem.cache_gem(@c2.file_name, @gemhome)
+ @b2_path = File.join @gemhome, 'cache', @b2.file_name
+ @c1_2_path = File.join @gemhome, 'cache', @c1_2.file_name
+ @c2_path = File.join @gemhome, 'cache', @c2.file_name
@source_index = Gem::SourceIndex.new
@source_index.add_spec @a1
@@ -319,39 +172,4 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
-
- def test_handle_options_system
- @cmd.handle_options %w[--system]
-
- expected = {
- :generate_ri => true,
- :system => true,
- :force => false,
- :args => [],
- :generate_rdoc => true,
- }
-
- assert_equal expected, @cmd.options
- end
-
- def test_handle_options_system_non_version
- assert_raises ArgumentError do
- @cmd.handle_options %w[--system non-version]
- end
- end
-
- def test_handle_options_system_specific
- @cmd.handle_options %w[--system 1.3.7]
-
- expected = {
- :generate_ri => true,
- :system => "1.3.7",
- :force => false,
- :args => [],
- :generate_rdoc => true,
- }
-
- assert_equal expected, @cmd.options
- end
-
end