Skip to content

Commit

Permalink
[rubygems/rubygems] Simplify --no-user-install spec
Browse files Browse the repository at this point in the history
This spec is ignoring the local `.gem` file, so most stuff is not
needed.

rubygems/rubygems@d52526800f
  • Loading branch information
deivid-rodriguez authored and hsbt committed Dec 5, 2023
1 parent 57178a9 commit a60718d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions test/rubygems/test_gem_commands_install_command.rb
Expand Up @@ -192,30 +192,23 @@ def test_execute_no_user_install
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|
spec_fetcher do |fetcher|
fetcher.gem "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::FilePermissionError do
@cmd.execute
end
ensure
FileUtils.chmod 0o755, @gemhome
end
end

Expand Down

0 comments on commit a60718d

Please sign in to comment.