summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-09-07 12:39:06 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2017-09-07 12:39:06 +0900
commit938bb4753270deb57643d114605134652aa5b5b2 (patch)
tree9da0d1e9e4b6c14ea452f3c155774277015dd392
parent6d9b2753c95d31b583792ff7363020e0083cbeb4 (diff)
downloadbundler-938bb4753270deb57643d114605134652aa5b5b2.tar.gz
Remove `File.expand_path` when it given Pathname object
-rw-r--r--spec/commands/exec_spec.rb4
-rw-r--r--spec/commands/newgem_spec.rb3
-rw-r--r--spec/commands/show_spec.rb2
-rw-r--r--spec/runtime/with_clean_env_spec.rb2
-rw-r--r--spec/support/artifice/endpoint.rb2
-rw-r--r--spec/support/helpers.rb10
6 files changed, 10 insertions, 13 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 486b73f385..2c86c6ab5f 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -61,8 +61,6 @@ RSpec.describe "bundle exec" do
it "handles --keep-file-descriptors" do
require "tempfile"
- bundle_bin = File.expand_path(bindir.join("bundle"), __FILE__)
-
command = Tempfile.new("io-test")
command.sync = true
command.write <<-G
@@ -71,7 +69,7 @@ RSpec.describe "bundle exec" do
else
require 'tempfile'
io = Tempfile.new("io-test-fd")
- args = %W[#{Gem.ruby} -I#{lib} #{bundle_bin} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
+ args = %W[#{Gem.ruby} -I#{lib} #{bindir.join("bundle")} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
args << { io.to_i => io } if RUBY_VERSION >= "2.0"
exec(*args)
end
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index c9cdc61c0a..494599abf1 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -170,11 +170,10 @@ RSpec.describe "bundle gem" do
# This spec cannot have `git` available in the test env
before do
- bundle_bin = File.expand_path(bindir.join("bundle"), __FILE__)
load_paths = [lib, spec]
load_path_str = "-I#{load_paths.join(File::PATH_SEPARATOR)}"
- sys_exec "PATH=\"\" #{Gem.ruby} #{load_path_str} #{bundle_bin} gem #{gem_name}"
+ sys_exec "PATH=\"\" #{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}"
end
it "creates the gem without the need for git" do
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index 70aa32349f..0bdf6a4a9c 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe "bundle show", :bundler => "< 2" do
it "prints the path to the running bundler" do
bundle "show bundler"
- expect(out).to eq(File.expand_path(root.to_s, __FILE__))
+ expect(out).to eq(root.to_s)
end
it "complains if gem not in bundle" do
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb
index 3ca7d1451f..b160e5b409 100644
--- a/spec/runtime/with_clean_env_spec.rb
+++ b/spec/runtime/with_clean_env_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "should clean up RUBYLIB" do
code = "print Bundler.clean_env['RUBYLIB']"
- ENV["RUBYLIB"] = File.expand_path(root.join("lib"), __FILE__) + File::PATH_SEPARATOR + "/foo"
+ ENV["RUBYLIB"] = root.join("lib").to_s + File::PATH_SEPARATOR + "/foo"
result = bundle("exec '#{Gem.ruby}' -e #{code.inspect}")
expect(result).to eq("/foo")
end
diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb
index 210f364a12..0d52130263 100644
--- a/spec/support/artifice/endpoint.rb
+++ b/spec/support/artifice/endpoint.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require File.expand_path("../../path.rb", __FILE__)
-require File.expand_path(Spec::Path.root.join("lib/bundler/deprecate"), __FILE__)
+require Spec::Path.root.join("lib/bundler/deprecate")
include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,rack,tilt,sinatra}-*/lib")].map(&:to_s))
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index ddbc8520a1..3cac274ee8 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -88,11 +88,11 @@ module Spec
end
def lib
- File.expand_path(root.join("lib"), __FILE__)
+ root.join("lib")
end
def spec
- File.expand_path(spec_dir.to_s, __FILE__)
+ spec_dir.to_s
end
def bundle(cmd, options = {})
@@ -102,7 +102,7 @@ module Spec
no_color = options.delete("no-color") { cmd.to_s !~ /\A(e|ex|exe|exec|conf|confi|config)(\s|\z)/ }
options["no-color"] = true if no_color
- bundle_bin = options.delete("bundle_bin") || File.expand_path(bindir.join("bundle"), __FILE__)
+ bundle_bin = options.delete("bundle_bin") || bindir.join("bundle")
if system_bundler = options.delete(:system_bundler)
bundle_bin = "-S bundle"
@@ -171,12 +171,12 @@ module Spec
end
def bundler(cmd, options = {})
- options["bundle_bin"] = File.expand_path(bindir.join("bundler"), __FILE__)
+ options["bundle_bin"] = bindir.join("bundler")
bundle(cmd, options)
end
def bundle_ruby(options = {})
- options["bundle_bin"] = File.expand_path(bindir.join("bundle_ruby"), __FILE__)
+ options["bundle_bin"] = bindir.join("bundle_ruby")
bundle("", options)
end