From 3316adaa07add862a56398566d456e87fa943386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 30 Oct 2019 19:33:09 +0100 Subject: Always use folder structure aware path helpers --- spec/commands/newgem_spec.rb | 2 +- spec/spec_helper.rb | 7 ++++--- spec/support/artifice/vcr.rb | 3 ++- spec/support/rubygems_version_manager.rb | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 493d300eb1..708b41f623 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -26,7 +26,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 = "#{tmp}/test_git_config.txt" File.open(path, "w") {|f| f.write(git_config_content) } ENV["GIT_CONFIG"] = path end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 98bc21e537..ba21d22fbd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true -$:.unshift File.expand_path("..", __FILE__) -$:.unshift File.expand_path("../../lib", __FILE__) +require_relative "support/path" + +$:.unshift Spec::Path.spec_dir.to_s +$:.unshift Spec::Path.lib_dir.to_s require "bundler/psyched_yaml" require "bundler/vendored_fileutils" @@ -20,7 +22,6 @@ require_relative "support/filters" require_relative "support/helpers" require_relative "support/indexes" require_relative "support/matchers" -require_relative "support/path" require_relative "support/parallel" require_relative "support/permissions" require_relative "support/platforms" diff --git a/spec/support/artifice/vcr.rb b/spec/support/artifice/vcr.rb index 1e3809ff62..a46f8e9391 100644 --- a/spec/support/artifice/vcr.rb +++ b/spec/support/artifice/vcr.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true require "net/http" +require_relative "../path" -CASSETTE_PATH = File.expand_path("../vcr_cassettes", __FILE__) +CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes" CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" } class BundlerVCRHTTP < Net::HTTP diff --git a/spec/support/rubygems_version_manager.rb b/spec/support/rubygems_version_manager.rb index b89d704e65..31f7cc4b08 100644 --- a/spec/support/rubygems_version_manager.rb +++ b/spec/support/rubygems_version_manager.rb @@ -85,7 +85,7 @@ private def resolve_local_copy_path return expanded_env_version if env_version_is_path? - rubygems_path = Pathname.new("../../tmp/rubygems").expand_path(__dir__) + rubygems_path = root.join("tmp/rubygems") unless rubygems_path.directory? rubygems_path.parent.mkpath -- cgit v1.2.1