diff options
Diffstat (limited to 'test/rubygems/test_gem_commands_install_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_install_command.rb | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 90c030951e..5b09512ac4 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -192,31 +192,26 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a pend "skipped on MS Windows (chmod has no effect)" if Gem.win_platform? pend "skipped in root privilege" if Process.uid.zero? - specs = spec_fetcher do |fetcher| - fetcher.gem "a", 2 + spec_fetcher do |fetcher| + fetcher.download "a", 2 end @cmd.options[:user_install] = false - FileUtils.mv specs["a-2"].cache_file, @tempdir - @cmd.options[:args] = %w[a] use_ui @ui do - orig_dir = Dir.pwd - begin - FileUtils.chmod 0o755, @userhome - FileUtils.chmod 0o555, @gemhome + FileUtils.chmod 0o755, @userhome + FileUtils.chmod 0o555, @gemhome - Dir.chdir @tempdir - assert_raise Gem::FilePermissionError do - @cmd.execute - end - ensure - Dir.chdir orig_dir - FileUtils.chmod 0o755, @gemhome + assert_raise Gem::MockGemUi::SystemExitException, @ui.error do + @cmd.execute end + ensure + FileUtils.chmod 0o755, @gemhome end + + assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name).sort end def test_execute_local_missing @@ -436,21 +431,6 @@ ERROR: Possible alternatives: non_existent_with_hint assert_equal expected, output end - def test_execute_conflicting_install_options - @cmd.options[:user_install] = true - @cmd.options[:install_dir] = "whatever" - - use_ui @ui do - assert_raise Gem::MockGemUi::TermError do - @cmd.execute - end - end - - expected = "ERROR: Use --install-dir or --user-install but not both\n" - - assert_equal expected, @ui.error - end - def test_execute_prerelease_skipped_when_no_flag_set spec_fetcher do |fetcher| fetcher.gem "a", 1 @@ -1357,7 +1337,7 @@ ERROR: Possible alternatives: non_existent_with_hint fetcher.gem "r", "2.0", "q" => nil end - i = Gem::Installer.at specs["q-1.0"].cache_file, :install_dir => "gf-path" + i = Gem::Installer.at specs["q-1.0"].cache_file, install_dir: "gf-path" i.install assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed" @@ -1554,7 +1534,7 @@ ERROR: Possible alternatives: non_existent_with_hint end def test_suggest_update_if_enabled - TestUpdateSuggestion.with_eglible_environment(cmd: @cmd) do + TestUpdateSuggestion.with_eligible_environment(cmd: @cmd) do spec_fetcher do |fetcher| fetcher.gem "a", 2 end |