[rubygems/rubygems] Fix gem update --system
for already installed version of rubygems-update
https://github.com/rubygems/rubygems/commit/c167d513a7
This commit is contained in:
parent
2dc365db79
commit
7c70151aed
@ -287,7 +287,7 @@ command to remove old versions.
|
|||||||
check_oldest_rubygems version
|
check_oldest_rubygems version
|
||||||
|
|
||||||
installed_gems = Gem::Specification.find_all_by_name 'rubygems-update', requirement
|
installed_gems = Gem::Specification.find_all_by_name 'rubygems-update', requirement
|
||||||
installed_gems = update_gem('rubygems-update', version) if installed_gems.empty?
|
installed_gems = update_gem('rubygems-update', version) if installed_gems.empty? || installed_gems.first.version != version
|
||||||
return if installed_gems.empty?
|
return if installed_gems.empty?
|
||||||
|
|
||||||
version = installed_gems.first.version
|
version = installed_gems.first.version
|
||||||
|
@ -157,6 +157,40 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
|
|||||||
assert_empty out
|
assert_empty out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_execute_system_update_installed
|
||||||
|
spec_fetcher do |fetcher|
|
||||||
|
fetcher.download 'rubygems-update', 8 do |s|
|
||||||
|
s.files = %w[setup.rb]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@cmd.options[:args] = []
|
||||||
|
@cmd.options[:system] = true
|
||||||
|
|
||||||
|
@cmd.execute
|
||||||
|
|
||||||
|
spec_fetcher do |fetcher|
|
||||||
|
fetcher.download 'rubygems-update', 9 do |s|
|
||||||
|
s.files = %w[setup.rb]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@cmd = Gem::Commands::UpdateCommand.new
|
||||||
|
@cmd.options[:args] = []
|
||||||
|
@cmd.options[:system] = true
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
out = @ui.output.split "\n"
|
||||||
|
assert_equal "Updating rubygems-update", 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
|
def test_execute_system_specific
|
||||||
spec_fetcher do |fetcher|
|
spec_fetcher do |fetcher|
|
||||||
fetcher.download 'rubygems-update', 8 do |s|
|
fetcher.download 'rubygems-update', 8 do |s|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user