summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_specification.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-08 01:32:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-08 01:32:18 +0000
commitc00e84327f14845bd484e76b5ee5dfeb1fa9ce3d (patch)
tree9f558dafa363f4f0118d504a50cd4461e2821cd1 /test/rubygems/test_gem_specification.rb
parent6b05153a3a75b74b64553d6a46f501d9ee0f0376 (diff)
Merge rubygems master.
This is RC version of Rubygems 2.7.0. https://github.com/rubygems/rubygems/commit/688fb7e83c13c3fe7c2bb03c49a2db4c82852aee git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_specification.rb')
-rw-r--r--test/rubygems/test_gem_specification.rb95
1 files changed, 85 insertions, 10 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 0fcc11e78f..bb6acbc7de 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1586,7 +1586,7 @@ dependencies: []
refute @ext.contains_requirable_file? 'nonexistent'
end
- expected = "Ignoring ext-1 because its extensions are not built. " +
+ expected = "Ignoring ext-1 because its extensions are not built. " +
"Try: gem pristine ext --version 1\n"
assert_equal expected, err
@@ -2748,14 +2748,6 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.email = ""
-
- use_ui @ui do
- @a1.validate
- end
-
- assert_match "#{w}: no email specified\n", @ui.error, "error"
-
@a1.email = "FIxxxXME (your e-mail)".sub(/xxx/, "")
e = assert_raises Gem::InvalidSpecificationException do
@@ -2977,6 +2969,43 @@ Did you mean 'Ruby'?
warning
end
+ def test_validate_empty_files
+ util_setup_validate
+
+ use_ui @ui do
+ # we have to set all of these for #files to be empty
+ @a1.files = []
+ @a1.test_files = []
+ @a1.executables = []
+
+ @a1.validate
+ end
+
+ assert_match "no files specified", @ui.error
+ end
+
+ def test_validate_empty_homepage
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.homepage = nil
+ @a1.validate
+ end
+
+ assert_match "no homepage specified", @ui.error
+ end
+
+ def test_validate_empty_summary
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.summary = nil
+ @a1.validate
+ end
+
+ assert_match "no summary specified", @ui.error
+ end
+
def test_validate_name
util_setup_validate
@@ -3252,7 +3281,11 @@ Did you mean 'Ruby'?
Dir.chdir @tempdir do
@m1 = quick_gem 'm', '1' do |s|
s.files = %w[lib/code.rb]
- s.metadata = { 'one' => "two", 'two' => "three" }
+ s.metadata = {
+ "one" => "two",
+ "home" => "three",
+ "homepage_uri" => "https://example.com/user/repo"
+ }
end
use_ui @ui do
@@ -3329,6 +3362,23 @@ Did you mean 'Ruby'?
end
end
+ def test_metadata_link_validation_fails
+ util_setup_validate
+
+ Dir.chdir @tempdir do
+ @m2 = quick_gem 'm', '2' do |s|
+ s.files = %w[lib/code.rb]
+ s.metadata = { 'homepage_uri' => 'http:/example.com' }
+ end
+
+ e = assert_raises Gem::InvalidSpecificationException do
+ @m2.validate
+ end
+
+ assert_equal "metadata['homepage_uri'] has invalid link: \"http:/example.com\"", e.message
+ end
+ end
+
def test_metadata_specs
valid_ruby_spec = <<-EOF
# -*- encoding: utf-8 -*-
@@ -3406,6 +3456,31 @@ end
refute @a1.missing_extensions?
end
+ def test_find_all_by_full_name
+ pl = Gem::Platform.new 'i386-linux'
+
+ a1 = util_spec "a", "1"
+ a1_pre = util_spec "a", "1.0.0.pre.1"
+ a_1_platform = util_spec("a", "1") {|s| s.platform = pl }
+ a_b_1 = util_spec "a-b", "1"
+ a_b_1_platform = util_spec("a-b", "1") {|s| s.platform = pl }
+
+ a_b_1_1 = util_spec "a-b-1", "1"
+ a_b_1_1_platform = util_spec("a-b-1", "1") {|s| s.platform = pl }
+
+ install_specs(a1, a1_pre, a_1_platform, a_b_1, a_b_1_platform,
+ a_b_1_1, a_b_1_1_platform)
+
+ assert_equal [a1], Gem::Specification.find_all_by_full_name("a-1")
+ assert_equal [a1_pre], Gem::Specification.find_all_by_full_name("a-1.0.0.pre.1")
+ assert_equal [a_1_platform], Gem::Specification.find_all_by_full_name("a-1-x86-linux")
+ assert_equal [a_b_1_1], Gem::Specification.find_all_by_full_name("a-b-1-1")
+ assert_equal [a_b_1_1_platform], Gem::Specification.find_all_by_full_name("a-b-1-1-x86-linux")
+
+ assert_equal [], Gem::Specification.find_all_by_full_name("monkeys")
+ assert_equal [], Gem::Specification.find_all_by_full_name("a-1-foo")
+ end
+
def test_find_by_name
install_specs util_spec "a"
install_specs util_spec "a", 1