diff options
Diffstat (limited to 'test/rubygems/test_gem_commands_install_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_install_command.rb | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 468aecde56..d05cfef653 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -647,17 +647,10 @@ ERROR: Possible alternatives: non_existent_with_hint @cmd.options[:args] = %w[a] use_ui @ui do - # Don't use Dir.chdir with a block, it warnings a lot because - # of a downstream Dir.chdir with a block - old = Dir.getwd - - begin - Dir.chdir @tempdir + Dir.chdir @tempdir do assert_raise Gem::MockGemUi::SystemExitException, @ui.error do @cmd.execute end - ensure - Dir.chdir old end end @@ -684,17 +677,10 @@ ERROR: Possible alternatives: non_existent_with_hint @cmd.options[:args] = %w[a] use_ui @ui do - # Don't use Dir.chdir with a block, it warnings a lot because - # of a downstream Dir.chdir with a block - old = Dir.getwd - - begin - Dir.chdir @tempdir + Dir.chdir @tempdir do assert_raise Gem::MockGemUi::SystemExitException, @ui.error do @cmd.execute end - ensure - Dir.chdir old end end @@ -720,17 +706,10 @@ ERROR: Possible alternatives: non_existent_with_hint @cmd.options[:args] = %w[a] use_ui @ui do - # Don't use Dir.chdir with a block, it warnings a lot because - # of a downstream Dir.chdir with a block - old = Dir.getwd - - begin - Dir.chdir @tempdir + Dir.chdir @tempdir do assert_raise Gem::MockGemUi::SystemExitException, @ui.error do @cmd.execute end - ensure - Dir.chdir old end end @@ -1005,6 +984,38 @@ ERROR: Possible alternatives: non_existent_with_hint assert_equal %W[a-3-#{local}], @cmd.installed_specs.map(&:full_name) end + def test_install_gem_platform_specificity_match + util_set_arch "arm64-darwin-20" + + spec_fetcher do |fetcher| + %w[ruby universal-darwin universal-darwin-20 x64-darwin-20 arm64-darwin-20].each do |platform| + fetcher.download "a", 3 do |s| + s.platform = platform + end + end + end + + @cmd.install_gem "a", ">= 0" + + assert_equal %w[a-3-arm64-darwin-20], @cmd.installed_specs.map(&:full_name) + end + + def test_install_gem_platform_specificity_match_reverse_order + util_set_arch "arm64-darwin-20" + + spec_fetcher do |fetcher| + %w[ruby universal-darwin universal-darwin-20 x64-darwin-20 arm64-darwin-20].reverse_each do |platform| + fetcher.download "a", 3 do |s| + s.platform = platform + end + end + end + + @cmd.install_gem "a", ">= 0" + + assert_equal %w[a-3-arm64-darwin-20], @cmd.installed_specs.map(&:full_name) + end + def test_install_gem_ignore_dependencies_specific_file spec = util_spec "a", 2 |