summaryrefslogtreecommitdiff
path: root/spec/commands
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-09-07 21:49:47 +0000
committerThe Bundler Bot <bot@bundler.io>2017-09-07 21:49:47 +0000
commit17b32f8ff4fe79a749190ec985aa5e160be427d3 (patch)
treee9d605aa69e7441628584e49a63cdd5c45e6421a /spec/commands
parent7577718410ca2264c2708b6a5d2534078e5b205f (diff)
parent938bb4753270deb57643d114605134652aa5b5b2 (diff)
downloadbundler-17b32f8ff4fe79a749190ec985aa5e160be427d3.tar.gz
Auto merge of #6007 - hsbt:use-halper-methods-for-path, r=segiddins
Use helper methods for relative path references in the specs Ruby core needs to change `Spec::Path.root` and gemspec, bin, spec directories structure. 1. I changed spec directory from `spec` to `spec/bundler` because ruby core has rubyspec files under the `spec/rubyspec`. 2. I changed gemspec location to `bundler.gemspec` to `lib/bundler.gemspec`. ref. https://bugs.ruby-lang.org/issues/12733#note-15 This pull request make we can modify root, gemspec path to flexible locations. After merging this pull request, I will add directory structure of ruby core repository to only `spec/support/path.rb`
Diffstat (limited to 'spec/commands')
-rw-r--r--spec/commands/exec_spec.rb6
-rw-r--r--spec/commands/newgem_spec.rb5
-rw-r--r--spec/commands/show_spec.rb2
3 files changed, 5 insertions, 8 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index add997f049..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("../../../exe/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
@@ -474,7 +472,7 @@ RSpec.describe "bundle exec" do
Bundler.rubygems.extend(Monkey)
G
bundle "install --deployment"
- bundle "exec ruby -e '`../../exe/bundler -v`; puts $?.success?'"
+ bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'"
expect(out).to match("true")
end
end
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 259c73a903..494599abf1 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe "bundle gem" do
user = bundleuser
EOF
@git_config_location = ENV["GIT_CONFIG"]
- path = "#{File.expand_path("../../tmp", File.dirname(__FILE__))}/test_git_config.txt"
+ path = "#{File.expand_path(tmp, File.dirname(__FILE__))}/test_git_config.txt"
File.open(path, "w") {|f| f.write(git_config_content) }
ENV["GIT_CONFIG"] = path
end
@@ -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("../../../exe/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 d91ac275d1..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("../../../", __FILE__))
+ expect(out).to eq(root.to_s)
end
it "complains if gem not in bundle" do