summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_config_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_config_file.rb')
-rw-r--r--test/rubygems/test_gem_config_file.rb42
1 files changed, 36 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index f53125cc0c..a055f248be 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -58,6 +58,7 @@ class TestGemConfigFile < Gem::TestCase
fp.puts ":ssl_verify_mode: 0"
fp.puts ":ssl_ca_cert: /etc/ssl/certs"
fp.puts ":cert_expiration_length_days: 28"
+ fp.puts ":install_extension_in_lib: true"
fp.puts ":ipv4_fallback_enabled: true"
end
@@ -73,6 +74,7 @@ class TestGemConfigFile < Gem::TestCase
assert_equal 0, @cfg.ssl_verify_mode
assert_equal "/etc/ssl/certs", @cfg.ssl_ca_cert
assert_equal 28, @cfg.cert_expiration_length_days
+ assert_equal true, @cfg.install_extension_in_lib
assert_equal true, @cfg.ipv4_fallback_enabled
end
@@ -191,7 +193,7 @@ class TestGemConfigFile < Gem::TestCase
util_config_file
- assert_equal({ :rubygems => "701229f217cdf23b1344c7b4b54ca97" },
+ assert_equal({ rubygems: "701229f217cdf23b1344c7b4b54ca97" },
@cfg.api_keys)
end
@@ -369,7 +371,7 @@ if you believe they were disclosed to a third party.
assert_equal "x", @cfg.rubygems_api_key
expected = {
- :rubygems_api_key => "x",
+ rubygems_api_key: "x",
}
assert_equal expected, load_yaml_file(@cfg.credentials_path)
@@ -393,7 +395,7 @@ if you believe they were disclosed to a third party.
end
expected = {
- :rubygems_api_key => "x",
+ rubygems_api_key: "x",
}
assert_equal expected, load_yaml_file(@cfg.credentials_path)
@@ -485,6 +487,16 @@ if you believe they were disclosed to a third party.
end
end
+ def test_accept_string_key
+ File.open @temp_conf, "w" do |fp|
+ fp.puts "verbose: false"
+ end
+
+ util_config_file
+
+ assert_equal false, @cfg.verbose
+ end
+
def test_load_ssl_verify_mode_from_config
File.open @temp_conf, "w" do |fp|
fp.puts ":ssl_verify_mode: 1"
@@ -509,8 +521,12 @@ if you believe they were disclosed to a third party.
assert_equal("/home/me/mine.pem", @cfg.ssl_client_cert)
end
- def util_config_file(args = @cfg_args)
- @cfg = Gem::ConfigFile.new args
+ def test_load_install_extension_in_lib_from_config
+ File.open @temp_conf, "w" do |fp|
+ fp.puts ":install_extension_in_lib: false"
+ end
+ util_config_file
+ assert_equal(false, @cfg.install_extension_in_lib)
end
def test_disable_default_gem_server
@@ -542,10 +558,24 @@ if you believe they were disclosed to a third party.
end
def test_dump_with_rubygems_yaml
- symbol_key_hash = { :foo => "bar" }
+ symbol_key_hash = { foo: "bar" }
actual = Gem::ConfigFile.dump_with_rubygems_yaml(symbol_key_hash)
assert_equal("---\n:foo: \"bar\"\n", actual)
end
+
+ def test_handle_comment
+ yaml = <<~YAML
+ ---
+ :foo: bar # buzz
+ YAML
+
+ actual = Gem::ConfigFile.load_with_rubygems_config_hash(yaml)
+ assert_equal("bar", actual[:foo])
+ end
+
+ def util_config_file(args = @cfg_args)
+ @cfg = Gem::ConfigFile.new args
+ end
end