2011-01-28 18:46:47 -05:00
|
|
|
require 'rubygems/test_case'
|
2008-03-31 18:40:06 -04:00
|
|
|
require 'rubygems/commands/update_command'
|
|
|
|
|
2011-03-07 03:44:45 -05:00
|
|
|
begin
|
|
|
|
gem "rdoc"
|
|
|
|
rescue Gem::LoadError
|
|
|
|
# ignore
|
|
|
|
end
|
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
class TestGemCommandsUpdateCommand < Gem::TestCase
|
2008-03-31 18:40:06 -04:00
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2013-09-14 04:59:02 -04:00
|
|
|
common_installer_setup
|
2008-03-31 18:40:06 -04:00
|
|
|
|
|
|
|
@cmd = Gem::Commands::UpdateCommand.new
|
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
@cmd.options[:document] = []
|
2009-06-09 17:38:59 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
@specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 1
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
fetcher.gem 'a', '3.a'
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
end
|
|
|
|
|
|
|
|
@a1_path = @specs['a-1'].cache_file
|
|
|
|
@a2_path = @specs['a-1'].cache_file
|
|
|
|
@a3a_path = @specs['a-3.a'].cache_file
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_execute
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
|
|
|
|
fetcher.clear
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2008-03-31 18: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-11 19:16:41 -05:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2011-03-07 03:44:45 -05:00
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2014-09-13 23:30:02 -04:00
|
|
|
def test_execute_multiple
|
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
fetcher.gem 'ab', 2
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
|
|
|
|
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-11 19:16:41 -05:00
|
|
|
def test_execute_system
|
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
2011-03-07 03:44:45 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.clear
|
2011-03-07 03:44:45 -05: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-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'rubygems-update', Gem::VERSION do |s|
|
|
|
|
s.files = %w[setup.rb]
|
|
|
|
end
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
end
|
2011-03-07 03:44:45 -05:00
|
|
|
|
|
|
|
@cmd.options[:args] = []
|
|
|
|
@cmd.options[:system] = true
|
|
|
|
|
2011-05-31 23:45:05 -04:00
|
|
|
assert_raises Gem::MockGemUi::SystemExitException do
|
2011-03-07 03:44:45 -05:00
|
|
|
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
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
end
|
2011-03-07 03:44:45 -05: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-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
end
|
2011-03-07 03:44:45 -05: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-03-31 18:40:06 -04:00
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_empty out
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
|
|
|
|
2011-05-31 23:45:05 -04:00
|
|
|
def test_execute_system_specifically_to_latest_version
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
|
|
|
|
fetcher.gem 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
|
|
|
|
|
|
|
|
fetcher.clear
|
|
|
|
end
|
2011-05-31 23: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 03:44:45 -05: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-03-31 18:40:06 -04:00
|
|
|
# before:
|
|
|
|
# a1 -> c1.2
|
|
|
|
# after:
|
|
|
|
# a2 -> b2 # new dependency
|
|
|
|
# a2 -> c2
|
|
|
|
|
|
|
|
def test_execute_dependencies
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2, 'b' => 2, 'c' => 2
|
|
|
|
fetcher.gem 'b', 2
|
|
|
|
fetcher.gem 'c', 2
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.clear
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.spec 'a', 1, 'c' => '1.2'
|
|
|
|
fetcher.spec 'c', '1.2'
|
|
|
|
end
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2011-05-31 23:45:05 -04:00
|
|
|
Gem::Specification.reset
|
|
|
|
|
2008-03-31 18: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-11 19:16:41 -05:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a b c",
|
2008-03-31 18:40:06 -04:00
|
|
|
out.shift
|
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_empty out
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
def test_execute_rdoc
|
2014-01-06 20:19:28 -05:00
|
|
|
skip if RUBY_VERSION <= "1.8.7"
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.clear
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
@cmd.options[:document] = %w[rdoc ri]
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a]
|
2012-11-29 01:52:18 -05:00
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@cmd.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_child_process_to_exit
|
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
a2 = @specs['a-2']
|
|
|
|
|
|
|
|
assert_path_exists File.join(a2.doc_dir, 'rdoc')
|
2012-11-29 01:52:18 -05:00
|
|
|
end
|
|
|
|
|
2008-03-31 18:40:06 -04:00
|
|
|
def test_execute_named
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
|
|
|
|
fetcher.clear
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
@cmd.options[:args] = %w[a]
|
2008-03-31 18: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-11 19:16:41 -05:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_empty out
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
|
|
|
|
2014-09-13 23:30:02 -04:00
|
|
|
def test_execute_named_some_up_to_date
|
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
fetcher.clear
|
|
|
|
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-03-31 18:40:06 -04:00
|
|
|
def test_execute_named_up_to_date
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.spec 'a', 2
|
|
|
|
end
|
2008-03-31 18:40:06 -04:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
@cmd.options[:args] = %w[a]
|
2008-03-31 18: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-09 17:38:59 -04:00
|
|
|
assert_empty out
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
|
|
|
|
2012-11-29 01:52:18 -05:00
|
|
|
def test_execute_named_up_to_date_prerelease
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', '3.a'
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.clear
|
2012-11-29 01:52:18 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
|
|
|
|
|
|
|
@cmd.options[:args] = %w[a]
|
2012-11-29 01:52:18 -05: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-11 19:16:41 -05:00
|
|
|
assert_equal "Updating a", out.shift
|
|
|
|
assert_equal "Gems updated: a", out.shift
|
2012-11-29 01:52:18 -05:00
|
|
|
|
|
|
|
assert_empty out
|
|
|
|
end
|
|
|
|
|
2008-03-31 18:40:06 -04:00
|
|
|
def test_execute_up_to_date
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
2008-03-31 18: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-09 17:38:59 -04:00
|
|
|
assert_empty out
|
2008-03-31 18:40:06 -04:00
|
|
|
end
|
2011-03-07 03:44:45 -05:00
|
|
|
|
2013-02-19 19:34:58 -05:00
|
|
|
def test_execute_user_install
|
2013-11-11 19:16:41 -05:00
|
|
|
spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 2
|
2013-02-19 19:34:58 -05:00
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
fetcher.clear
|
|
|
|
|
|
|
|
fetcher.spec 'a', 1
|
|
|
|
end
|
2013-02-19 19:34:58 -05: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-15 20:14:16 -04:00
|
|
|
def test_fetch_remote_gems
|
2013-11-11 19:16:41 -05:00
|
|
|
specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 1
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
end
|
|
|
|
|
2013-10-15 20:14:16 -04:00
|
|
|
expected = [
|
|
|
|
[Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
]
|
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-15 20: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-11 19:16:41 -05:00
|
|
|
@cmd.fetch_remote_gems @specs['a-1']
|
2013-10-15 20:14:16 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-18 18:14:56 -04:00
|
|
|
def test_fetch_remote_gems_mismatch
|
|
|
|
platform = Gem::Platform.new 'x86-freebsd9'
|
|
|
|
|
2013-11-11 19:16:41 -05: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-18 18:14:56 -04:00
|
|
|
|
|
|
|
expected = [
|
|
|
|
[Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
|
|
|
|
Gem::Source.new(@gem_repo)],
|
|
|
|
]
|
|
|
|
|
2013-11-11 19:16:41 -05:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-18 18:14:56 -04:00
|
|
|
end
|
|
|
|
|
2013-10-15 20:14:16 -04:00
|
|
|
def test_fetch_remote_gems_prerelease
|
2013-11-11 19:16:41 -05:00
|
|
|
specs = spec_fetcher do |fetcher|
|
|
|
|
fetcher.gem 'a', 1
|
|
|
|
fetcher.gem 'a', 2
|
|
|
|
fetcher.gem 'a', '3.a'
|
|
|
|
end
|
|
|
|
|
2013-10-15 20: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-11 19:16:41 -05:00
|
|
|
assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
|
2013-10-15 20:14:16 -04:00
|
|
|
end
|
|
|
|
|
2011-03-07 03:44:45 -05:00
|
|
|
def test_handle_options_system
|
|
|
|
@cmd.handle_options %w[--system]
|
|
|
|
|
|
|
|
expected = {
|
2012-11-29 01:52:18 -05:00
|
|
|
:args => [],
|
|
|
|
:document => %w[rdoc ri],
|
|
|
|
:force => false,
|
|
|
|
:system => true,
|
2011-03-07 03:44:45 -05: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 01:52:18 -05:00
|
|
|
:args => [],
|
|
|
|
:document => %w[rdoc ri],
|
|
|
|
:force => false,
|
|
|
|
:system => "1.3.7",
|
2011-03-07 03:44:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal expected, @cmd.options
|
|
|
|
end
|
|
|
|
|
2014-09-13 23: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-18 17: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-03-31 18:40:06 -04:00
|
|
|
end
|
2013-09-18 17:29:41 -04:00
|
|
|
|