summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_dependency_installer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_dependency_installer.rb')
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 0d1a564..bbab5fe 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -794,6 +794,19 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal Gem::Source.new(@gem_repo), s.source
end
+ def test_find_spec_by_name_and_version_bad_gem
+ FileUtils.touch 'rdoc.gem'
+
+ inst = Gem::DependencyInstaller.new
+
+ e = assert_raises Gem::Package::FormatError do
+ inst.find_spec_by_name_and_version 'rdoc.gem'
+ end
+
+ full_path = File.join @tempdir, 'rdoc.gem'
+ assert_equal "package metadata is missing in #{full_path}", e.message
+ end
+
def test_find_spec_by_name_and_version_directory
Dir.mkdir 'rdoc'
@@ -808,6 +821,20 @@ class TestGemDependencyInstaller < Gem::TestCase
e.message
end
+ def test_find_spec_by_name_and_version_file
+ FileUtils.touch 'rdoc'
+
+ inst = Gem::DependencyInstaller.new
+
+ e = assert_raises Gem::SpecificGemNotFoundException do
+ inst.find_spec_by_name_and_version 'rdoc'
+ end
+
+ assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
+ "locally or in a repository",
+ e.message
+ end
+
def test_find_gems_with_sources_local
util_setup_gems