summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems.rb2
-rw-r--r--test/rubygems/test_gem.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 2703525..dbb32b2 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1217,7 +1217,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def register_default_spec(spec)
extended_require_paths = spec.require_paths.map {|f| f + "/"}
- new_format = spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
+ new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
if new_format
prefix_group = extended_require_paths.join("|")
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index d64a253..6b18bb9 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1750,6 +1750,18 @@ class TestGem < Gem::TestCase
assert_nil Gem.find_unresolved_default_spec("README")
end
+ def test_register_default_spec_old_style_with_folder_starting_with_lib
+ Gem.clear_default_specs
+
+ old_style = Gem::Specification.new do |spec|
+ spec.files = ["libexec/bundle", "foo.rb", "bar.rb"]
+ end
+
+ Gem.register_default_spec old_style
+
+ assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
+ end
+
def test_use_gemdeps
gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
spec = util_spec 'a', 1