summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2021-01-28 17:54:29 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2021-01-28 18:00:10 +0900
commit00bd645f09ef96af55e4060deee7882a46d33206 (patch)
tree6813360f0dc8d1dedbc4c61069886c56f8ced2c5 /spec
parentedaf0c250c7589101c7a512b62acf51b7595ed1a (diff)
downloadruby-00bd645f09ef96af55e4060deee7882a46d33206.tar.gz
Delete path including `/../` too
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/support/matchers.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index 01e11eb94d..3d926f5774 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -123,7 +123,10 @@ module Spec
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
code = []
- code << "$LOAD_PATH.delete '#{exclude_from_load_path}'" if exclude_from_load_path
+ if exclude_from_load_path
+ code << "exclude_from_load_path = File.expand_path('#{exclude_from_load_path}')"
+ code << "$LOAD_PATH.delete_if { |path| File.expand_path(path) == exclude_from_load_path }"
+ end
code << "require '#{require_path}.rb'"
code << "puts #{version_const}"
run code.join("; "), *groups