summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--lib/rubygems/basic_specification.rb2
-rw-r--r--lib/rubygems/commands/install_command.rb6
-rw-r--r--lib/rubygems/request_set.rb10
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb4
-rw-r--r--lib/rubygems/source.rb14
-rw-r--r--lib/rubygems/source/installed.rb1
-rw-r--r--lib/rubygems/spec_fetcher.rb7
-rw-r--r--lib/rubygems/stub_specification.rb7
-rw-r--r--lib/rubygems/test_case.rb6
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb111
-rw-r--r--test/rubygems/test_gem_dependency_resolver_vendor_specification.rb11
-rw-r--r--test/rubygems/test_gem_request_set.rb28
-rw-r--r--test/rubygems/test_gem_source.rb10
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb18
-rw-r--r--test/rubygems/test_gem_specification.rb9
-rw-r--r--test/rubygems/test_gem_stub_specification.rb21
17 files changed, 165 insertions, 116 deletions
diff --git a/ChangeLog b/ChangeLog
index 53e320b3f0..d5323901a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Sat Oct 19 06:55:52 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems master 0a3814b. Changes:
+
+ Fixed extension directory in Gem::Specification#require_paths.
+
+ Allow installation of gems when $HOME is nonexistent or unwritable.
+
+ Use proper API in InstallCommand.
+
+ Improve support for path option in gem dependency files.
+
+ Remove warnings.
+
+ * test/rubygems: ditto.
+
Fri Oct 18 15:23:34 2013 Koichi Sasada <ko1@atdot.net>
* gc.c: change terminology of heap.
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 7f738155c9..7d0469000b 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -176,7 +176,7 @@ class Gem::BasicSpecification
return @require_paths if @extensions.empty?
relative_extension_install_dir =
- File.join '..', '..', '..', 'extensions', Gem::Platform.local.to_s,
+ File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, full_name
@require_paths + [relative_extension_install_dir]
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 0bb40ed633..1f3210ff5d 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -135,7 +135,7 @@ to write the specification by hand. For example:
def execute
if gf = options[:gemdeps] then
install_from_gemdeps gf
- return
+ return # not reached
end
@installed_specs = []
@@ -151,7 +151,7 @@ to write the specification by hand. For example:
show_installed
- raise Gem::SystemExitException, exit_code
+ terminate_interaction exit_code
end
def install_from_gemdeps gf # :nodoc:
@@ -173,7 +173,7 @@ to write the specification by hand. For example:
@installed_specs = specs
- raise Gem::SystemExitException, 0
+ terminate_interaction
end
def install_gem name, version # :nodoc:
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index eb45516cfb..9a7ac83e91 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -159,7 +159,15 @@ class Gem::RequestSet
# Resolve the requested dependencies and return an Array of Specification
# objects to be activated.
- def resolve set = nil
+ def resolve set = Gem::DependencyResolver::IndexSet.new
+ sets = [set, @vendor_set].compact
+
+ set = if sets.size == 1 then
+ sets.first
+ else
+ Gem::DependencyResolver.compose_sets(*sets)
+ end
+
resolver = Gem::DependencyResolver.new @dependencies, set
resolver.development = @development
resolver.soft_missing = @soft_missing
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index 40dccb6433..f11ffb12c3 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -51,8 +51,8 @@ class Gem::RequestSet::GemDependencyAPI
@vendor_set.add_vendor_gem name, directory
end
- group = options.delete :group
- all_groups = group ? Array(group) : []
+ g = options.delete :group
+ all_groups = g ? Array(g) : []
groups = options.delete :groups
all_groups |= groups if groups
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index ecfb6c8897..394ea6cf22 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -47,12 +47,7 @@ class Gem::Source
include Comparable
def ==(other)
- case other
- when self.class
- @uri == other.uri
- else
- false
- end
+ self.class === other and @uri == other.uri
end
alias_method :eql?, :==
@@ -71,7 +66,12 @@ class Gem::Source
end
def update_cache?
- @update_cache ||= File.stat(Gem.user_home).uid == Process.uid
+ @update_cache ||=
+ begin
+ File.stat(Gem.user_home).uid == Process.uid
+ rescue Errno::ENOENT
+ false
+ end
end
def fetch_spec(name)
diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb
index 7709778791..8e3a3560bf 100644
--- a/lib/rubygems/source/installed.rb
+++ b/lib/rubygems/source/installed.rb
@@ -1,6 +1,7 @@
class Gem::Source::Installed < Gem::Source
def initialize
+ @uri = nil
end
##
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 3ae7afc9d9..4bef93351f 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -38,7 +38,12 @@ class Gem::SpecFetcher
end
def initialize
- @update_cache = File.stat(Gem.user_home).uid == Process.uid
+ @update_cache =
+ begin
+ File.stat(Gem.user_home).uid == Process.uid
+ rescue Errno::EACCES, Errno::ENOENT
+ false
+ end
@specs = {}
@latest_specs = {}
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index ffa2d3f964..221dc1d404 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -165,5 +165,12 @@ class Gem::StubSpecification < Gem::BasicSpecification
@version ||= data.version
end
+ ##
+ # Is there a stub line present for this StubSpecification?
+
+ def stubbed?
+ data.is_a? StubLine
+ end
+
end
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index a5a81d72a2..1e6d9feeeb 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1098,11 +1098,15 @@ Also, a list:
##
# A vendor_gem is used with a gem dependencies file. The gem created here
# has no files, just a gem specification for the given +name+ and +version+.
+ #
+ # Yields the +specification+ to the block, if given
def vendor_gem name = 'a', version = 1
directory = File.join 'vendor', name
- vendor_spec = Gem::Specification.new name, version
+ vendor_spec = Gem::Specification.new name, version do |specification|
+ yield specification if block_given?
+ end
FileUtils.mkdir_p directory
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 24159e4c71..625d85e372 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -38,10 +38,9 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = [@a2.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -62,10 +61,9 @@ class TestGemCommandsInstallCommand < Gem::TestCase
assert @cmd.options[:version].satisfied_by?(@a2_pre.version)
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -83,10 +81,9 @@ class TestGemCommandsInstallCommand < Gem::TestCase
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code
ensure
Dir.chdir orig_dir
end
@@ -131,7 +128,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = %w[no_such_gem]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -156,7 +153,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -184,7 +181,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
assert_equal 2, e.exit_code
@@ -206,7 +203,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
@cmd.options[:args] = [misspelled]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
@@ -230,7 +227,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [misspelled]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
@@ -273,10 +270,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [@a2_pre.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
assert_equal %w[a-1], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -296,10 +292,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [@a2_pre.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
assert_equal %w[a-2.a], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -319,10 +314,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [@a2_pre.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code, @ui.error
end
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -347,14 +341,12 @@ ERROR: Possible alternatives: non_existent_with_hint
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
ensure
Dir.chdir old
end
-
- assert_equal 0, e.exit_code
end
wait_for_child_process_to_exit
@@ -383,14 +375,12 @@ ERROR: Possible alternatives: non_existent_with_hint
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
ensure
Dir.chdir old
end
-
- assert_equal 0, e.exit_code
end
path = @a2.build_info_file
@@ -410,12 +400,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [@a2.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -448,10 +435,9 @@ ERROR: Possible alternatives: non_existent_with_hint
use_ui @ui do
Dir.chdir @tempdir do
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code
end
end
@@ -478,10 +464,9 @@ ERROR: Possible alternatives: non_existent_with_hint
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
@cmd.execute
end
- assert_equal 0, e.exit_code
ensure
Dir.chdir orig_dir
end
@@ -529,7 +514,7 @@ ERROR: Possible alternatives: non_existent_with_hint
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException do
@cmd.execute
end
ensure
@@ -560,7 +545,7 @@ ERROR: Possible alternatives: non_existent_with_hint
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
ensure
@@ -582,7 +567,7 @@ ERROR: Possible alternatives: non_existent_with_hint
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
@cmd.execute
end
ensure
@@ -607,12 +592,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [@a2.name]
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -639,12 +621,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
assert_equal %w[], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -667,12 +646,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
@@ -698,12 +674,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
names = @cmd.installed_specs.map { |spec| spec.full_name }
@@ -733,12 +706,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
names = @cmd.installed_specs.map { |spec| spec.full_name }
@@ -768,12 +738,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
names = @cmd.installed_specs.map { |spec| spec.full_name }
@@ -808,12 +775,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
names = @cmd.installed_specs.map { |spec| spec.full_name }
@@ -850,12 +814,9 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:gemdeps] = @gemdeps
use_ui @ui do
- e = assert_raises Gem::SystemExitException do
- capture_io do
- @cmd.execute
- end
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
end
- assert_equal 0, e.exit_code
end
names = @cmd.installed_specs.map { |spec| spec.full_name }
diff --git a/test/rubygems/test_gem_dependency_resolver_vendor_specification.rb b/test/rubygems/test_gem_dependency_resolver_vendor_specification.rb
index 7617243234..c1d668c777 100644
--- a/test/rubygems/test_gem_dependency_resolver_vendor_specification.rb
+++ b/test/rubygems/test_gem_dependency_resolver_vendor_specification.rb
@@ -10,15 +10,6 @@ class TestGemDependencyResolverVendorSpecification < Gem::TestCase
@spec = Gem::Specification.new 'a', 1
end
- def test_initialize
- v_spec = Gem::DependencyResolver::VendorSpecification.new @set, @spec
-
- assert_equal 'a', v_spec.name
- assert_equal v(1), v_spec.version
- assert_equal Gem::Platform::RUBY, v_spec.platform
- assert_equal Gem::Source::Vendor.new, v_spec.source
- end
-
def test_equals2
v_spec_a = Gem::DependencyResolver::VendorSpecification.new @set, @spec
@@ -80,7 +71,7 @@ class TestGemDependencyResolverVendorSpecification < Gem::TestCase
v_spec = Gem::DependencyResolver::VendorSpecification.new @set, spec
- assert_equal v(1), spec.version
+ assert_equal v(1), v_spec.version
end
end
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index 5076072791..12a1942d54 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -56,6 +56,34 @@ class TestGemRequestSet < Gem::TestCase
assert_equal ["a-2", "b-2"], names
end
+ def test_resolve_vendor
+ a_name, _, a_directory = vendor_gem 'a', 1 do |s|
+ s.add_dependency 'b', '~> 2.0'
+ end
+
+ b_name, _, b_directory = vendor_gem 'b', 2
+
+ rs = Gem::RequestSet.new
+
+ Tempfile.open 'gem.deps.rb' do |io|
+ io.puts <<-gems_deps_rb
+ gem "#{a_name}", :path => "#{a_directory}"
+ gem "#{b_name}", :path => "#{b_directory}"
+ gems_deps_rb
+
+ io.flush
+
+ rs.load_gemdeps io.path
+ end
+
+ res = rs.resolve
+ assert_equal 2, res.size
+
+ names = res.map { |s| s.full_name }.sort
+
+ assert_equal ["a-1", "b-2"], names
+ end
+
def test_sorted_requests
a = util_spec "a", "2", "b" => ">= 2"
b = util_spec "b", "2", "c" => ">= 2"
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index cb43121ddd..61fb682001 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -207,5 +207,15 @@ class TestGemSource < Gem::TestCase
assert_equal(-1, remote. <=>(no_uri), 'remote <=> no_uri')
end
+ def test_update_cache_eh
+ assert @source.update_cache?
+ end
+
+ def test_update_cache_eh_home_nonexistent
+ FileUtils.rmdir Gem.user_home
+
+ refute @source.update_cache?
+ end
+
end
diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb
index 8be10a30b9..9e9a8e4d69 100644
--- a/test/rubygems/test_gem_spec_fetcher.rb
+++ b/test/rubygems/test_gem_spec_fetcher.rb
@@ -52,6 +52,24 @@ class TestGemSpecFetcher < Gem::TestCase
['x', Gem::Version.new(1), 'ruby']]
end
+ def test_initialize_unwritable_home_dir
+ FileUtils.rmdir Gem.user_home
+
+ assert Gem::SpecFetcher.new
+ end
+
+ def test_initialize_unwritable_home_dir
+ skip 'chmod not supported' if Gem.win_platform?
+
+ FileUtils.chmod 0000, Gem.user_home
+
+ begin
+ assert Gem::SpecFetcher.new
+ ensure
+ FileUtils.chmod 0755, Gem.user_home
+ end
+ end
+
def test_spec_for_dependency_all
d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
@fetcher.data["#{d}#{@a1.spec_name}.rz"] = util_zip(Marshal.dump(@a1))
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 0fd4a2e224..d893a7191e 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1659,12 +1659,11 @@ dependencies: []
@ext.require_path = 'lib'
- lib = Pathname File.join @ext.gem_dir, 'lib'
+ ext_install_dir = Pathname(@ext.extension_install_dir)
+ full_gem_path = Pathname(@ext.full_gem_path)
+ relative_install_dir = ext_install_dir.relative_path_from full_gem_path
- ext_install_dir =
- Pathname(@ext.extension_install_dir).relative_path_from lib
-
- assert_equal ['lib', ext_install_dir.to_s], @ext.require_paths
+ assert_equal ['lib', relative_install_dir.to_s], @ext.require_paths
ensure
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
end
diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb
index e315e2c01a..8f9cadbcf3 100644
--- a/test/rubygems/test_gem_stub_specification.rb
+++ b/test/rubygems/test_gem_stub_specification.rb
@@ -17,6 +17,7 @@ class TestStubSpecification < Gem::TestCase
assert_equal Gem::Version.new("0.0.1"), @foo.version
assert_equal Gem::Platform.new("mswin32"), @foo.platform
assert_equal ["lib", "lib/f oo/ext"], @foo.require_paths
+ assert @foo.stubbed?
end
def test_initialize_extension
@@ -24,17 +25,16 @@ class TestStubSpecification < Gem::TestCase
gem_dir = File.join stub.gems_dir, stub.full_name
- lib = Pathname File.join gem_dir, 'lib'
+ ext_install_dir = Pathname(stub.extension_install_dir)
+ full_gem_path = Pathname(stub.full_gem_path)
+ relative_install_dir = ext_install_dir.relative_path_from full_gem_path
+ relative_install_dir = relative_install_dir.to_s
- ext_install_dir =
- Pathname(stub.extension_install_dir).relative_path_from lib
- ext_install_dir = ext_install_dir.to_s
-
- assert_equal 'stub_e', stub.name
- assert_equal v(2), stub.version
- assert_equal Gem::Platform::RUBY, stub.platform
- assert_equal ['lib', ext_install_dir], stub.require_paths
- assert_equal %w[ext/stub_e/extconf.rb], stub.extensions
+ assert_equal 'stub_e', stub.name
+ assert_equal v(2), stub.version
+ assert_equal Gem::Platform::RUBY, stub.platform
+ assert_equal ['lib', relative_install_dir], stub.require_paths
+ assert_equal %w[ext/stub_e/extconf.rb], stub.extensions
end
def test_initialize_missing_stubline
@@ -43,6 +43,7 @@ class TestStubSpecification < Gem::TestCase
assert_equal Gem::Version.new("0.0.2"), stub.version
assert_equal Gem::Platform.new("ruby"), stub.platform
assert_equal ["lib"], stub.require_paths
+ assert !stub.stubbed?
end
def test_contains_requirable_file_eh