summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_request_set.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_request_set.rb')
-rw-r--r--test/rubygems/test_gem_request_set.rb35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index 4aaa15ac68..9b215c2bc7 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -160,6 +160,37 @@ class TestGemRequestSet < Gem::TestCase
assert_equal %w!c-2 b-2 a-2!, names
end
+ def test_install
+ spec_fetcher do |fetcher|
+ fetcher.gem "a", "1", "b" => "= 1"
+ fetcher.gem "b", "1"
+
+ fetcher.clear
+ end
+
+ rs = Gem::RequestSet.new
+ rs.gem 'a'
+
+ rs.resolve
+
+ reqs = []
+ installers = []
+
+ installed = rs.install({}) do |req, installer|
+ reqs << req
+ installers << installer
+ end
+
+ assert_equal %w[b-1 a-1], reqs.map { |req| req.full_name }
+ assert_equal %w[b-1 a-1],
+ installers.map { |installer| installer.spec.full_name }
+
+ assert_path_exists File.join @gemhome, 'specifications', 'a-1.gemspec'
+ assert_path_exists File.join @gemhome, 'specifications', 'b-1.gemspec'
+
+ assert_equal %w[b-1 a-1], installed.map { |s| s.full_name }
+ end
+
def test_install_into
spec_fetcher do |fetcher|
fetcher.gem "a", "1", "b" => "= 1"
@@ -173,8 +204,8 @@ class TestGemRequestSet < Gem::TestCase
installed = rs.install_into @tempdir
- assert File.exists?(File.join(@tempdir, "specifications", "a-1.gemspec"))
- assert File.exists?(File.join(@tempdir, "specifications", "b-1.gemspec"))
+ assert_path_exists File.join @tempdir, 'specifications', 'a-1.gemspec'
+ assert_path_exists File.join @tempdir, 'specifications', 'b-1.gemspec'
assert_equal %w!b-1 a-1!, installed.map { |s| s.full_name }
end