Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Add spec for using relative requires
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Apr 22, 2019
1 parent c3b917c commit a48a24b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/rubygems_integration.rb
Expand Up @@ -637,7 +637,7 @@ def path_separator
end

def all_specs
require "bundler/remote_specification"
require_relative "remote_specification"
Gem::Specification.stubs.map do |stub|
StubSpecification.from_stub(stub)
end
Expand Down
16 changes: 16 additions & 0 deletions spec/quality_spec.rb
Expand Up @@ -275,4 +275,20 @@ def check_for_specific_pronouns(filename)
expect(warnings).to be_well_formed
end
end

it "does not use require internally, but require_relative" do
Dir.chdir(root) do
exempt = %r{templates/|vendor/}
all_bad_requires = []
lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
lib_files.split("\x0").each do |filename|
next if filename =~ exempt
File.readlines(filename).each_with_index do |line, number|
line.scan(/^ *require ['"]bundler/).each { all_bad_requires << "#{filename}:#{number.succ}" }
end
end

expect(all_bad_requires).to be_empty, "#{all_bad_requires.size} bad requires: #{all_bad_requires}"
end
end
end

0 comments on commit a48a24b

Please sign in to comment.