Permalink
Browse files

Add test to ensure good perms on user's credentials file

  • Loading branch information...
1 parent b94513b commit 09a34ca2a35a49748ebea09a263cb00dfd2b9d6c @zettabyte zettabyte committed May 21, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 test/rubygems/test_gem_config_file.rb
@@ -309,10 +309,12 @@ def test_load_api_keys_from_config
:other => 'a5fdbb6ba150cbb83aad2bb2fede64c'}, @cfg.api_keys)
end
- def test_save_credentials_with_strict_permissions
+ def test_save_credentials_file_with_strict_permissions
util_config_file
- @cfg
- assert_equal mask, File.stat(path).mode unless win_platform?
+ FileUtils.mkdir File.dirname(@cfg.credentials_path)
+ @cfg.rubygems_api_key = '701229f217cdf23b1344c7b4b54ca97'
+ mode = 0100600 & (~File.umask)
+ assert_equal mode, File.stat(@cfg.credentials_path).mode unless win_platform?
end
def util_config_file(args = @cfg_args)

0 comments on commit 09a34ca

Please sign in to comment.