diff options
author | Kazuhiro NISHIYAMA <[email protected]> | 2021-01-28 17:54:29 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <[email protected]> | 2021-01-28 18:00:10 +0900 |
commit | 00bd645f09ef96af55e4060deee7882a46d33206 (patch) | |
tree | 6813360f0dc8d1dedbc4c61069886c56f8ced2c5 | |
parent | edaf0c250c7589101c7a512b62acf51b7595ed1a (diff) |
Delete path including `/../` too
-rw-r--r-- | spec/bundler/support/matchers.rb | 5 |
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 |