diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 03:08:14 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 03:08:14 +0000 |
commit | 5dbc6583c93621a7e992163bd27991bd3d3d9378 (patch) | |
tree | 93d60f32d81d9ee58b538586f44acccbbc27c230 /test/rubygems/test_gem_commands_install_command.rb | |
parent | b52761e4f71326099374515e494b1667b2bbf84b (diff) |
Merge rubygems upstream from https://github.com/rubygems/rubygems/commit/2c499655f29070c809dfea9f5fda6fac6850e62e
https://github.com/rubygems/rubygems/pull/2493
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_install_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_install_command.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index b024c77c70..0976a31b50 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -393,6 +393,23 @@ ERROR: Possible alternatives: non_existent_with_hint assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name } end + def test_execute_with_version_specified_by_colon + spec_fetcher do |fetcher| + fetcher.download 'a', 1 + fetcher.download 'a', 2 + end + + @cmd.options[:args] = %w[a:1] + + use_ui @ui do + assert_raises Gem::MockGemUi::SystemExitException, @ui.error do + @cmd.execute + end + end + + assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name } + end + def test_execute_prerelease_skipped_when_non_pre_available spec_fetcher do |fetcher| fetcher.gem 'a', '2.pre' @@ -649,12 +666,31 @@ ERROR: Possible alternatives: non_existent_with_hint assert_empty @cmd.installed_specs msg = "ERROR: Can't use --version with multiple gems. You can specify multiple gems with" \ - " version requirments using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`" + " version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`" assert_empty @ui.output assert_equal msg, @ui.error.chomp end + def test_execute_two_version_specified_by_colon + spec_fetcher do |fetcher| + fetcher.gem 'a', 1 + fetcher.gem 'a', 2 + fetcher.gem 'b', 1 + fetcher.gem 'b', 2 + end + + @cmd.options[:args] = %w[a:1 b:1] + + use_ui @ui do + assert_raises Gem::MockGemUi::SystemExitException, @ui.error do + @cmd.execute + end + end + + assert_equal %w[a-1 b-1], @cmd.installed_specs.map { |spec| spec.full_name } + end + def test_execute_conservative spec_fetcher do |fetcher| fetcher.download 'b', 2 |