summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/commands/newgem_spec.rb4
-rw-r--r--spec/runtime/gem_tasks_spec.rb4
-rw-r--r--spec/spec_helper.rb13
-rw-r--r--spec/support/helpers.rb6
-rw-r--r--spec/support/rubygems_ext.rb2
5 files changed, 12 insertions, 17 deletions
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 4b5db87b00..598d68ec3a 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -327,7 +327,7 @@ RSpec.describe "bundle gem" do
end
Dir.chdir(bundled_app(gem_name)) do
- sys_exec("rake")
+ sys_exec(rake)
expect(out).to include("SUCCESS")
end
end
@@ -612,7 +612,7 @@ RSpec.describe "bundle gem" do
end
Dir.chdir(bundled_app(gem_name)) do
- sys_exec("rake")
+ sys_exec(rake)
expect(out).to include("SUCCESS")
end
end
diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb
index 5fc87a6d46..1cf808f35b 100644
--- a/spec/runtime/gem_tasks_spec.rb
+++ b/spec/runtime/gem_tasks_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "includes the relevant tasks" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "ruby -S rake -T"
+ sys_exec "#{rake} -T"
end
expect(err).to eq("")
@@ -37,7 +37,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "adds 'pkg' to rake/clean's CLOBBER" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec! %('#{Gem.ruby}' -S rake -e 'load "Rakefile"; puts CLOBBER.inspect')
+ sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect')
end
expect(last_command.stdout).to eq '["pkg"]'
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 228b9e5aa3..1091c0b7f3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -28,23 +28,12 @@ require "bundler/vendored_fileutils"
require "uri"
require "digest"
-if File.expand_path(__FILE__) =~ %r{([^\w/\.-])}
+if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])}
abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})"
end
require "bundler"
-# Require the correct version of popen for the current platform
-if RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
- begin
- require "win32/open3"
- rescue LoadError
- abort "Run `gem install win32-open3` to be able to run specs"
- end
-else
- require "open3"
-end
-
Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file|
file = file.gsub(%r{\A#{Regexp.escape File.expand_path("..", __FILE__)}/}, "")
require file unless file.end_with?("hax.rb")
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index d64b3923d5..87d6152522 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "open3"
+
module Spec
module Helpers
def reset!
@@ -214,6 +216,10 @@ module Spec
end
bang :gem_command
+ def rake
+ "#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
+ end
+
def sys_exec(cmd)
command_execution = CommandExecution.new(cmd.to_s, Dir.pwd)
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 806933fe2f..c18f7650fc 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -33,7 +33,7 @@ module Spec
ENV["BUNDLE_PATH"] = nil
ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
- ENV["PATH"] = ["#{Path.root}/exe", "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR)
+ ENV["PATH"] = [Path.bindir, "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR)
manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" }
manifest_path = "#{Path.base_system_gems}/manifest.txt"