2016-02-01 15:43:26 +03:00
|
|
|
# frozen_string_literal: true
|
2011-01-29 02:46:47 +03:00
|
|
|
require 'rubygems/test_case'
|
2008-04-01 02:40:06 +04:00
|
|
|
require 'rubygems/commands/update_command'
|
|
|
|
|
2011-01-29 02:46:47 +03:00
|
|
|
class TestGemCommandsUpdateCommand < Gem::TestCase
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2013-09-14 12:59:02 +04:00
|
|
|
common_installer_setup
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
@cmd = Gem::Commands::UpdateCommand.new
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
@cmd.options[:document] = []
|
2009-06-10 01:38:59 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
@specs = spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 1
|
|
|
|
fetcher.download 'a', 2
|
|
|
|
fetcher.download 'a', '3.a'
|
2013-11-12 04:16:41 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
@a1_path = @specs['a-1'].cache_file
|
|
|
|
@a2_path = @specs['a-1'].cache_file
|
|
|
|
@a3a_path = @specs['a-3.a'].cache_file
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2011-03-07 11:44:45 +03:00
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2014-09-14 07:30:02 +04:00
|
|
|
def test_execute_multiple
|
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
|
|
|
fetcher.download 'ab', 2
|
2014-09-14 07:30:02 +04:00
|
|
|
|
|
|
|
fetcher.spec 'a', 1
|
|
|
|
fetcher.spec 'ab', 1
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a]
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
def test_execute_system
|
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
2011-03-07 11:44:45 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
@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_at_latest
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'rubygems-update', Gem::VERSION do |s|
|
2013-11-12 04:16:41 +04:00
|
|
|
s.files = %w[setup.rb]
|
|
|
|
end
|
|
|
|
end
|
2011-03-07 11:44:45 +03:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
@cmd.options[:system] = true
|
|
|
|
|
2011-06-01 07:45:05 +04:00
|
|
|
assert_raises Gem::MockGemUi::SystemExitException do
|
2011-03-07 11:44:45 +03:00
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
2017-10-08 04:32:18 +03:00
|
|
|
assert_equal "Latest version already installed. Done.", out.shift
|
2011-03-07 11:44:45 +03:00
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute_system_multiple
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
2013-11-12 04:16:41 +04:00
|
|
|
end
|
2011-03-07 11:44:45 +03:00
|
|
|
|
|
|
|
@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
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
2013-11-12 04:16:41 +04:00
|
|
|
end
|
2011-03-07 11:44:45 +03:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
@cmd.options[:system] = "8"
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating rubygems-update", out.shift
|
|
|
|
assert_equal "Installing RubyGems 8", out.shift
|
|
|
|
assert_equal "RubyGems system software updated", out.shift
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
assert_empty out
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
|
|
|
|
2011-06-01 07:45:05 +04:00
|
|
|
def test_execute_system_specifically_to_latest_version
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
2013-11-12 04:16:41 +04:00
|
|
|
end
|
2011-06-01 07:45:05 +04:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
@cmd.options[:system] = "9"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2011-03-07 11:44:45 +03:00
|
|
|
def test_execute_system_with_gems
|
|
|
|
@cmd.options[:args] = %w[gem]
|
|
|
|
@cmd.options[:system] = true
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
# before:
|
|
|
|
# a1 -> c1.2
|
|
|
|
# after:
|
|
|
|
# a2 -> b2 # new dependency
|
|
|
|
# a2 -> c2
|
|
|
|
|
|
|
|
def test_execute_dependencies
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2, 'b' => 2, 'c' => 2
|
|
|
|
fetcher.download 'b', 2
|
|
|
|
fetcher.download 'c', 2
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.spec 'a', 1, 'c' => '1.2'
|
|
|
|
fetcher.spec 'c', '1.2'
|
|
|
|
end
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2011-06-01 07:45:05 +04:00
|
|
|
Gem::Specification.reset
|
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
@cmd.options[:args] = []
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a b c",
|
2008-04-01 02:40:06 +04:00
|
|
|
out.shift
|
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
assert_empty out
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
def test_execute_rdoc
|
2014-01-07 05:19:28 +04:00
|
|
|
skip if RUBY_VERSION <= "1.8.7"
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2012-11-29 10:52:18 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
2012-11-29 10:52:18 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
@cmd.options[:document] = %w[rdoc ri]
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a]
|
2012-11-29 10:52:18 +04:00
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_child_process_to_exit
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
a2 = @specs['a-2']
|
|
|
|
|
|
|
|
assert_path_exists File.join(a2.doc_dir, 'rdoc')
|
2015-04-12 11:36:37 +03:00
|
|
|
end
|
2012-11-29 10:52:18 +04:00
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
def test_execute_named
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
@cmd.options[:args] = %w[a]
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
assert_empty out
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
|
|
|
|
2014-09-14 07:30:02 +04:00
|
|
|
def test_execute_named_some_up_to_date
|
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
2014-09-14 07:30:02 +04:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
|
|
|
|
fetcher.spec 'b', 2
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a b]
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
|
|
|
assert_equal "Gems already up-to-date: b", out.shift
|
|
|
|
|
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
def test_execute_named_up_to_date
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.spec 'a', 2
|
|
|
|
end
|
2008-04-01 02:40:06 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
@cmd.options[:args] = %w[a]
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
|
|
|
assert_equal "Nothing to update", out.shift
|
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
assert_empty out
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
def test_execute_named_up_to_date_prerelease
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', '3.a'
|
2012-11-29 10:52:18 +04:00
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a]
|
2012-11-29 10:52:18 +04:00
|
|
|
@cmd.options[:prerelease] = true
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2012-11-29 10:52:18 +04:00
|
|
|
|
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
def test_execute_up_to_date
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
2008-04-01 02:40:06 +04:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
out = @ui.output.split "\n"
|
|
|
|
assert_equal "Updating installed gems", out.shift
|
|
|
|
assert_equal "Nothing to update", out.shift
|
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
assert_empty out
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
2011-03-07 11:44:45 +03:00
|
|
|
|
2013-02-20 04:34:58 +04:00
|
|
|
def test_execute_user_install
|
2013-11-12 04:16:41 +04:00
|
|
|
spec_fetcher do |fetcher|
|
2015-07-02 00:50:14 +03:00
|
|
|
fetcher.download 'a', 2
|
2013-11-12 04:16:41 +04:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2013-02-20 04:34:58 +04:00
|
|
|
|
|
|
|
@cmd.handle_options %w[--user-install]
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
installer = @cmd.installer
|
|
|
|
user_install = installer.instance_variable_get :@user_install
|
|
|
|
|
|
|
|
assert user_install, 'user_install must be set on the installer'
|
|
|
|
end
|
|
|
|
|
2013-10-16 04:14:16 +04:00
|
|
|
def test_fetch_remote_gems
|
2013-11-12 04:16:41 +04:00
|
|
|
specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 1
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
|
|
|
|
2013-10-16 04:14:16 +04:00
|
|
|
expected = [
|
|
|
|
[Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
]
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-16 04:14:16 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_fetch_remote_gems_error
|
|
|
|
Gem.sources.replace %w[http://nonexistent.example]
|
|
|
|
|
|
|
|
assert_raises Gem::RemoteFetcher::FetchError do
|
2013-11-12 04:16:41 +04:00
|
|
|
@cmd.fetch_remote_gems @specs['a-1']
|
2013-10-16 04:14:16 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-19 02:14:56 +04:00
|
|
|
def test_fetch_remote_gems_mismatch
|
|
|
|
platform = Gem::Platform.new 'x86-freebsd9'
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.spec 'a', 1
|
|
|
|
fetcher.spec 'a', 2
|
|
|
|
fetcher.spec 'a', 2 do |s| s.platform = platform end
|
|
|
|
end
|
2013-10-19 02:14:56 +04:00
|
|
|
|
|
|
|
expected = [
|
|
|
|
[Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
]
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-19 02:14:56 +04:00
|
|
|
end
|
|
|
|
|
2013-10-16 04:14:16 +04:00
|
|
|
def test_fetch_remote_gems_prerelease
|
2013-11-12 04:16:41 +04:00
|
|
|
specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 1
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
fetcher.gem 'a', '3.a'
|
|
|
|
end
|
|
|
|
|
2013-10-16 04:14:16 +04:00
|
|
|
@cmd.options[:prerelease] = true
|
|
|
|
|
|
|
|
expected = [
|
|
|
|
[Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
[Gem::NameTuple.new('a', v('3.a'), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
]
|
|
|
|
|
2013-11-12 04:16:41 +04:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-16 04:14:16 +04:00
|
|
|
end
|
|
|
|
|
2011-03-07 11:44:45 +03:00
|
|
|
def test_handle_options_system
|
|
|
|
@cmd.handle_options %w[--system]
|
|
|
|
|
|
|
|
expected = {
|
2012-11-29 10:52:18 +04:00
|
|
|
:args => [],
|
|
|
|
:document => %w[rdoc ri],
|
|
|
|
:force => false,
|
|
|
|
:system => true,
|
2011-03-07 11:44:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 = {
|
2012-11-29 10:52:18 +04:00
|
|
|
:args => [],
|
|
|
|
:document => %w[rdoc ri],
|
|
|
|
:force => false,
|
|
|
|
:system => "1.3.7",
|
2011-03-07 11:44:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal expected, @cmd.options
|
|
|
|
end
|
|
|
|
|
2014-10-01 12:30:21 +04:00
|
|
|
def test_update_gem_prerelease
|
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.spec 'a', '1.a'
|
|
|
|
fetcher.gem 'a', '1.b'
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.update_gem 'a', Gem::Requirement.new('= 1.b')
|
|
|
|
|
|
|
|
refute_empty @cmd.updated
|
|
|
|
|
|
|
|
assert @cmd.installer.instance_variable_get :@prerelease
|
|
|
|
end
|
|
|
|
|
2014-09-14 07:30:02 +04:00
|
|
|
def test_update_gem_unresolved_dependency
|
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.spec 'a', 1
|
|
|
|
fetcher.gem 'a', 2 do |s|
|
|
|
|
s.add_dependency 'b', '>= 2'
|
|
|
|
end
|
|
|
|
|
|
|
|
fetcher.spec 'b', 1
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.update_gem 'a'
|
|
|
|
|
|
|
|
assert_empty @cmd.updated
|
|
|
|
end
|
|
|
|
|
2013-09-19 01:29:41 +04:00
|
|
|
def test_update_rubygems_arguments
|
|
|
|
@cmd.options[:system] = true
|
|
|
|
|
|
|
|
arguments = @cmd.update_rubygems_arguments
|
|
|
|
|
|
|
|
assert_equal '--prefix', arguments.shift
|
|
|
|
assert_equal Gem.prefix, arguments.shift
|
|
|
|
assert_equal '--no-rdoc', arguments.shift
|
|
|
|
assert_equal '--no-ri', arguments.shift
|
|
|
|
assert_equal '--previous-version', arguments.shift
|
|
|
|
assert_equal Gem::VERSION, arguments.shift
|
|
|
|
assert_empty arguments
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_update_rubygems_arguments_1_8_x
|
|
|
|
@cmd.options[:system] = '1.8.26'
|
|
|
|
|
|
|
|
arguments = @cmd.update_rubygems_arguments
|
|
|
|
|
|
|
|
assert_equal '--prefix', arguments.shift
|
|
|
|
assert_equal Gem.prefix, arguments.shift
|
|
|
|
assert_equal '--no-rdoc', arguments.shift
|
|
|
|
assert_equal '--no-ri', arguments.shift
|
|
|
|
assert_empty arguments
|
|
|
|
end
|
|
|
|
|
2008-04-01 02:40:06 +04:00
|
|
|
end
|
2015-04-12 11:36:37 +03:00
|
|
|
|